diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index f2aa67ce33..1f6e8b4f3e 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -52,7 +52,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': workspace:1.1.0-beta.8 + '@visactor/vchart': workspace:1.1.0-beta.9 '@visactor/vgrammar': ~0.4.1 '@visactor/vrender': ~0.13.2 '@visactor/vutils': ~0.13.3 @@ -132,7 +132,7 @@ importers: '@types/webpack-env': ^1.13.6 '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:1.1.0-beta.8 + '@visactor/vchart': workspace:1.1.0-beta.9 '@vitejs/plugin-react': 3.1.0 babel-preset-taro: 3.3.17 eslint: ~8.18.0 diff --git a/packages/block-vchart/block/vchart/index.js b/packages/block-vchart/block/vchart/index.js index c3527f7260..95d2b6d2e1 100644 --- a/packages/block-vchart/block/vchart/index.js +++ b/packages/block-vchart/block/vchart/index.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";const e=t=>t;var i,n;t.RenderModeEnum=void 0,(i=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",i["mobile-browser"]="mobile-browser",i.node="node",i.worker="worker",i.miniApp="miniApp",i["desktop-miniApp"]="desktop-miniApp",i.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.customMark="customMark"}(n||(n={}));for(let t=0;t<256;t++)t.toString(16);const s=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};class r{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let i=0;for(let n=0;n0){for(r=t[--s];s>0&&(e=r,i=t[--s],r=e+i,n=i-(r-e),!n););s>0&&(n<0&&t[s-1]<0||n>0&&t[s-1]>0)&&(i=2*n,e=r+i,i==e-r&&(r=e))}return r}}function a(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}var o=1e-6,l=1e-12,h=Math.PI,c=h/2,d=h/4,u=2*h,p=180/h,g=h/180,f=Math.abs,m=Math.atan,y=Math.atan2,_=Math.cos,v=Math.exp,b=Math.log,x=Math.pow,S=Math.sin,w=Math.sign||function(t){return t>0?1:t<0?-1:0},A=Math.sqrt,k=Math.tan;function M(t){return t>1?0:t<-1?h:Math.acos(t)}function C(t){return t>1?c:t<-1?-c:Math.asin(t)}function T(){}function E(t,e){t&&P.hasOwnProperty(t.type)&&P[t.type](t,e)}var R={Feature:function(t,e){E(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nh&&(t-=Math.round(t/u)*u),[t,e]}function U(t,e,i){return(t%=u)?e||i?V(Y(t),$(e,i)):Y(t):e||i?$(e,i):W}function G(t){return function(e,i){return f(e+=t)>h&&(e-=Math.round(e/u)*u),[e,i]}}function Y(t){var e=G(t);return e.invert=G(-t),e}function $(t,e){var i=_(t),n=S(t),s=_(e),r=S(e);function a(t,e){var a=_(e),o=_(t)*a,l=S(t)*a,h=S(e),c=h*i+o*n;return[y(l*s-c*r,o*i-h*n),C(c*s+l*r)]}return a.invert=function(t,e){var a=_(e),o=_(t)*a,l=S(t)*a,h=S(e),c=h*s-l*r;return[y(l*s+h*r,o*i+c*n),C(c*i-o*n)]},a}function X(t,e){(e=O(e))[0]-=t,N(e);var i=M(-e[1]);return((-e[2]<0?-i:i)+u-o)%u}function K(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:T,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function q(t,e){return f(t[0]-e[0])=0;--r)s.point((d=c[r])[0],d[1]);else n(p.x,p.p.x,-1,s);p=p.p}c=(p=p.o).z,g=!g}while(!p.v);s.lineEnd()}}}function Q(t){if(e=t.length){for(var e,i,n=0,s=t[0];++n=0?1:-1,H=F*L,j=H>h,V=M*I;if(f.add(y(V*F*S(H),T*D+V*_(H))),p+=j?L+F*u:L,j^A>=i^P>=i){var W=z(O(w),O(R));N(W);var U=z(a,W);N(U);var G=(j^L>=0?-1:1)*C(U[2]);(n>G||n===G&&(W[0]||W[1]))&&(g+=j^L>=0?1:-1)}}return(p<-o||p0){for(x||(s.polygonStart(),x=!0),s.lineStart(),t=0;t1&&2&r&&a.push(a.pop().concat(a.shift())),g.push(a.filter(nt))}return w}}function nt(t){return t.length>1}function st(t,e){return((t=t.x)[0]<0?t[1]-c-o:c-t[1])-((e=e.x)[0]<0?e[1]-c-o:c-e[1])}W.invert=W;var rt=it((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var l=r>0?h:-h,d=f(r-i);f(d-h)0?c:-c),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(r,n),e=0):s!==l&&d>=h&&(f(i-s)o?m((S(e)*(r=_(n))*S(i)-S(n)*(s=_(e))*S(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(l,n),e=0),t.point(i=r,n=a),s=l},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*c,n.point(-h,s),n.point(0,s),n.point(h,s),n.point(h,0),n.point(h,-s),n.point(0,-s),n.point(-h,-s),n.point(-h,0),n.point(-h,s);else if(f(t[0]-e[0])>o){var r=t[0]0,s=f(e)>o;function r(t,i){return _(t)*_(i)>e}function a(t,i,n){var s=[1,0,0],r=z(O(t),O(i)),a=F(r,r),l=r[0],c=a-l*l;if(!c)return!n&&t;var d=e*a/c,u=-e*l/c,p=z(s,r),g=j(s,d);H(g,j(r,u));var m=p,y=F(g,m),_=F(m,m),v=y*y-_*(F(g,g)-1);if(!(v<0)){var b=A(v),x=j(m,(-y-b)/_);if(H(x,g),x=L(x),!n)return x;var S,w=t[0],k=i[0],M=t[1],C=i[1];k0^x[1]<(f(x[0]-w)h^(w<=x[0]&&x[0]<=k)){var R=j(m,(-y+b)/_);return H(R,g),[x,L(R)]}}}function l(e,i){var s=n?t:h-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return it(r,(function(t){var e,i,o,c,d;return{lineStart:function(){c=o=!1,d=1},point:function(u,p){var g,f=[u,p],m=r(u,p),y=n?m?0:l(u,p):m?l(u+(u<0?h:-h),p):0;if(!e&&(c=o=m)&&t.lineStart(),m!==o&&(!(g=a(e,f))||q(e,g)||q(f,g))&&(f[2]=1),m!==o)d=0,m?(t.lineStart(),g=a(f,e),t.point(g[0],g[1])):(g=a(e,f),t.point(g[0],g[1],2),t.lineEnd()),e=g;else if(s&&e&&n^m){var _;y&i||!(_=a(f,e,!0))||(d=0,n?(t.lineStart(),t.point(_[0][0],_[0][1]),t.point(_[1][0],_[1][1]),t.lineEnd()):(t.point(_[1][0],_[1][1]),t.lineEnd(),t.lineStart(),t.point(_[0][0],_[0][1],3)))}!m||e&&q(e,f)||t.point(f[0],f[1]),e=f,o=m,i=y},lineEnd:function(){o&&t.lineEnd(),e=null},clean:function(){return d|(c&&o)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=_(e),o=S(e),l=n*i;null==s?(s=e+n*u,r=e-l/2):(s=X(a,s),r=X(a,r),(n>0?sr)&&(s+=n*u));for(var h,c=s;n>0?c>r:c0)do{o.point(0===h||3===h?t:i,h>1?n:e)}while((h=(h+a+4)%4)!==d);else o.point(r[0],r[1])}function l(n,s){return f(n[0]-t)0?0:3:f(n[0]-i)0?2:1:f(n[1]-e)0?1:0:s>0?3:2}function h(t,e){return c(t.x,e.x)}function c(t,e){var i=l(t,1),n=l(e,1);return i!==n?i-n:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(o){var l,c,d,u,p,g,f,m,y,_,v,b=o,x=K(),S={point:w,lineStart:function(){S.point=A,c&&c.push(d=[]);_=!0,y=!1,f=m=NaN},lineEnd:function(){l&&(A(u,p),g&&y&&x.rejoin(),l.push(x.result()));S.point=w,y&&b.lineEnd()},polygonStart:function(){b=x,l=[],c=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=c.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=v&&e,s=(l=a(l)).length;(i||s)&&(o.polygonStart(),i&&(o.lineStart(),r(null,null,1,o),o.lineEnd()),s&&J(l,h,e,r,o),o.polygonEnd());b=o,l=c=d=null}};function w(t,e){s(t,e)&&b.point(t,e)}function A(r,a){var o=s(r,a);if(c&&d.push([r,a]),_)u=r,p=a,g=o,_=!1,o&&(b.lineStart(),b.point(r,a));else if(o&&y)b.point(r,a);else{var l=[f=Math.max(lt,Math.min(ot,f)),m=Math.max(lt,Math.min(ot,m))],h=[r=Math.max(lt,Math.min(ot,r)),a=Math.max(lt,Math.min(ot,a))];!function(t,e,i,n,s,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=s-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,h,t,e,i,n)?o&&(b.lineStart(),b.point(r,a),v=!1):(y||(b.lineStart(),b.point(l[0],l[1])),b.point(h[0],h[1]),o||b.lineEnd(),v=!1)}f=r,m=a,y=o}return S}}var ct,dt,ut,pt,gt=t=>t,ft=new r,mt=new r,yt={point:T,lineStart:T,lineEnd:T,polygonStart:function(){yt.lineStart=_t,yt.lineEnd=xt},polygonEnd:function(){yt.lineStart=yt.lineEnd=yt.point=T,ft.add(f(mt)),mt=new r},result:function(){var t=ft/2;return ft=new r,t}};function _t(){yt.point=vt}function vt(t,e){yt.point=bt,ct=ut=t,dt=pt=e}function bt(t,e){mt.add(pt*t-ut*e),ut=t,pt=e}function xt(){bt(ct,dt)}var St=yt,wt=1/0,At=wt,kt=-wt,Mt=kt,Ct={point:function(t,e){tkt&&(kt=t);eMt&&(Mt=e)},lineStart:T,lineEnd:T,polygonStart:T,polygonEnd:T,result:function(){var t=[[wt,At],[kt,Mt]];return kt=Mt=-(At=wt=1/0),t}};var Tt,Et,Rt,Pt,Bt=Ct,It=0,Dt=0,Lt=0,Ot=0,Ft=0,zt=0,Ht=0,jt=0,Nt=0,Vt={point:Wt,lineStart:Ut,lineEnd:$t,polygonStart:function(){Vt.lineStart=Xt,Vt.lineEnd=Kt},polygonEnd:function(){Vt.point=Wt,Vt.lineStart=Ut,Vt.lineEnd=$t},result:function(){var t=Nt?[Ht/Nt,jt/Nt]:zt?[Ot/zt,Ft/zt]:Lt?[It/Lt,Dt/Lt]:[NaN,NaN];return It=Dt=Lt=Ot=Ft=zt=Ht=jt=Nt=0,t}};function Wt(t,e){It+=t,Dt+=e,++Lt}function Ut(){Vt.point=Gt}function Gt(t,e){Vt.point=Yt,Wt(Rt=t,Pt=e)}function Yt(t,e){var i=t-Rt,n=e-Pt,s=A(i*i+n*n);Ot+=s*(Rt+t)/2,Ft+=s*(Pt+e)/2,zt+=s,Wt(Rt=t,Pt=e)}function $t(){Vt.point=Wt}function Xt(){Vt.point=qt}function Kt(){Zt(Tt,Et)}function qt(t,e){Vt.point=Zt,Wt(Tt=Rt=t,Et=Pt=e)}function Zt(t,e){var i=t-Rt,n=e-Pt,s=A(i*i+n*n);Ot+=s*(Rt+t)/2,Ft+=s*(Pt+e)/2,zt+=s,Ht+=(s=Pt*t-Rt*e)*(Rt+t),jt+=s*(Pt+e),Nt+=3*s,Wt(Rt=t,Pt=e)}var Jt=Vt;function Qt(t){this._context=t}Qt.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,u)}},result:T};var te,ee,ie,ne,se,re=new r,ae={point:T,lineStart:function(){ae.point=oe},lineEnd:function(){te&&le(ee,ie),ae.point=T},polygonStart:function(){te=!0},polygonEnd:function(){te=null},result:function(){var t=+re;return re=new r,t}};function oe(t,e){ae.point=le,ee=ne=t,ie=se=e}function le(t,e){ne-=t,se-=e,re.add(A(ne*ne+se*se)),ne=t,se=e}var he=ae;let ce,de,ue,pe;class ge{constructor(t){this._append=null==t?fe:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return fe;if(e!==ce){const t=10**e;ce=e,de=function(e){let i=1;this._+=e[0];for(const n=e.length;i=0))throw new RangeError(`invalid digits: ${t}`);s=e}return null===e&&(n=new ge(s)),a},a.projection(t).digits(s).context(e)}function ye(t){return function(e){var i=new _e;for(var n in t)i[n]=t[n];return i.stream=e,i}}function _e(){}function ve(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),D(i,t.stream(Bt)),e(Bt.result()),null!=n&&t.clipExtent(n),t}function be(t,e,i){return ve(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function xe(t,e,i){return be(t,[[0,0],e],i)}function Se(t,e,i){return ve(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function we(t,e,i){return ve(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}_e.prototype={constructor:_e,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Ae=16,ke=_(30*g);function Me(t,e){return+e?function(t,e){function i(n,s,r,a,l,h,c,d,u,p,g,m,_,v){var b=c-n,x=d-s,S=b*b+x*x;if(S>4*e&&_--){var w=a+p,k=l+g,M=h+m,T=A(w*w+k*k+M*M),E=C(M/=T),R=f(f(M)-1)e||f((b*D+x*L)/S-.5)>.3||a*p+l*g+h*m2?t[2]%360*g:0,B()):[_*p,v*p,b*p]},R.angle=function(t){return arguments.length?(x=t%360*g,B()):x*p},R.reflectX=function(t){return arguments.length?(S=t?-1:1,B()):S<0},R.reflectY=function(t){return arguments.length?(w=t?-1:1,B()):w<0},R.precision=function(t){return arguments.length?(a=Me(o,E=t*t),I()):A(E)},R.fitExtent=function(t,e){return be(R,t,e)},R.fitSize=function(t,e){return xe(R,t,e)},R.fitWidth=function(t,e){return Se(R,t,e)},R.fitHeight=function(t,e){return we(R,t,e)},function(){return e=t.apply(this,arguments),R.invert=e.invert&&P,B()}}function Pe(t){var e=0,i=h/3,n=Re(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*g,i=t[1]*g):[e*p,i*p]},s}function Be(t,e){var i=S(t),n=(i+S(e))/2;if(f(n)2?t[2]*g:0),e.invert=function(e){return(e=t.invert(e[0]*g,e[1]*g))[0]*=p,e[1]*=p,e},e}(s.rotate()).invert([0,0]));return l(null==c?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===He?[[Math.max(o[0]-r,c),e],[Math.min(o[0]+r,i),n]]:[[c,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),d()):a()},s.translate=function(t){return arguments.length?(o(t),d()):o()},s.center=function(t){return arguments.length?(r(t),d()):r()},s.clipExtent=function(t){return arguments.length?(null==t?c=e=i=n=null:(c=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),d()):null==c?null:[[c,e],[i,n]]},d()}function Ve(t){return k((c+t)/2)}function We(t,e){var i=_(t),n=t===e?S(t):b(i/_(e))/b(Ve(e)/Ve(t)),s=i*x(Ve(t),n)/n;if(!n)return He;function r(t,e){s>0?e<-c+o&&(e=-c+o):e>c-o&&(e=c-o);var i=s/x(Ve(e),n);return[i*S(n*t),s-i*_(n*t)]}return r.invert=function(t,e){var i=s-e,r=w(n)*A(t*t+i*i),a=y(t,f(i))*w(i);return i*n<0&&(a-=h*w(t)*w(i)),[a/n,2*m(x(s/r,1/n))-c]},r}function Ue(t,e){return[t,e]}function Ge(t,e){var i=_(t),n=t===e?S(t):(i-_(e))/(e-t),s=i/n+t;if(f(n)o&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ti.invert=Oe(C),ei.invert=Oe((function(t){return 2*m(t)})),ii.invert=function(t,e){return[-e,2*m(v(t))-c]},je().translate([0,0]).center([0,0]).scale(63781);var ni="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function si(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ri(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var ai=Object.prototype.hasOwnProperty;function oi(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^di[2]^di[3])}function pi(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=oi(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return ui(r[t])}function S(t,e){return li(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=mi(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ci(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Ti(t,e)}))}:Ti(t,e)}function Ti(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=Ei(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function Ei(t,e){var i=ki(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function Ii(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Mi(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=Di(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=ji(t.slice(0,n),e),o=ji(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Ni=ji;!function(t){var e=Ni;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;rObject.prototype.toString.call(t)===`[object ${e}]`,Yi=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||Gi(t,"Boolean")},$i=t=>"function"==typeof t,Xi=t=>null==t,Ki=t=>null!=t,qi=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},Zi=t=>"object"==typeof t&&null!==t,Ji=function(t){if(!Zi(t)||!Gi(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},Qi=t=>void 0===t,tn=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||Gi(t,"String")},en=t=>Array.isArray?Array.isArray(t):Gi(t,"Array"),nn=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},sn=t=>Gi(t,"Date"),rn=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||Gi(t,"Number")},an=t=>rn(t)&&Number.isFinite(t),on=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),ln=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),hn=Object.prototype,cn=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||hn)},dn=Object.prototype.hasOwnProperty;function un(t){if(Xi(t))return!0;if(nn(t))return!t.length;const e=ln(t);if("Map"===e||"Set"===e)return!t.size;if(cn(t))return!Object.keys(t).length;for(const e in t)if(dn.call(t,e))return!1;return!0}const pn=(t,e,i)=>{const n=tn(e)?e.split("."):e;for(let e=0;enull!=t&&gn.call(t,e);function mn(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(en(i)?o=[]:Gi(i,"RegExp")?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=sn(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)}function yn(t){let e;if(!Ki(t)||"object"!=typeof t)return t;const i=en(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:Yi(t)||rn(t)||tn(t)?t:sn(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=yn(n)}return e}function _n(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(Ki(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];Ki(n[r])&&"object"==typeof n[r]?vn(t,e,r,i):bn(t,r,n[r])}}}}function vn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(en(r)){if(n)a=[];else if(en(s))a=s;else if(nn(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!An(t[i],e[i]))return!1;return!0}if(!Ji(t))return!1;const i=wn(t),n=wn(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!An(t[s],e[s]))return!1}return!0}function kn(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function Rn(t,e){if(!en(t)||!en(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Bn(t,e,i){Ki(e)||(e=t,t=0),Ki(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function Dn(t){return Number(t)}function Ln(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Dn;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function On(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(Xi(n)&&(n=t.length);i>>1;In(t[s],e)>0?n=s:i=s+1}return i}const Fn=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(In)),Ln(i,.5)},zn=Math.sqrt(50),Hn=Math.sqrt(10),jn=Math.sqrt(2);function Nn(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=zn?s*=10:r>=Hn?s*=5:r>=jn&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:Vn,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wn)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function Gn(t,e,i,n){return t>e&&!Un(t,e,i,n)}function Yn(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},Xn=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?$n(n,r)+s:"center"===i?$n(n,Math.floor(r/2))+s+$n(n,Math.ceil(r/2)):s+$n(n,r)},Kn=function(t,e,i){return ti?i:t},qn=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function Zn(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let Jn=!1;try{Jn="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){Jn=!1}function Qn(t,e,i){let n,s,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&Jn;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function m(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(m(t))return _(t);o=f(y,function(t){const i=t-h,n=e-(t-l);return d?Math.min(n,r-i):n}(t))}function _(t){return o=void 0,u&&n?g(t):(n=s=void 0,a)}function v(){const t=Date.now(),i=m(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function is(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}Jn=!1;const ns=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ss=new RegExp(ns.source,"g");const rs=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function as(t){if(t instanceof Date)return t;if(tn(t)){const e=rs.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return Xi(t)?new Date(NaN):new Date(Math.round(t))}const os=1e-12,ls=Math.PI,hs=ls/2,cs=2*ls,ds=2*Math.PI,us=Math.abs,ps=Math.atan2,gs=Math.cos,fs=Math.max,ms=Math.min,ys=Math.sin,_s=Math.sqrt,vs=Math.pow;function bs(t){return t>1?0:t<-1?ls:Math.acos(t)}function xs(t){return t>=1?hs:t<=-1?-hs:Math.asin(t)}function Ss(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function ws(t,e){return t[0]*e[1]-t[1]*e[0]}class As{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new As(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return rn(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return rn(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ks{static distancePP(t,e){return _s(vs(t.x-e.x,2)+vs(t.y-e.y,2))}static distanceNN(t,e,i,n){return _s(vs(t-i,2)+vs(e-n,2))}static distancePN(t,e,i){return _s(vs(e-t.x,2)+vs(i-t.y,2))}static pointAtPP(t,e,i){return new As((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Ms(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Cs{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Cs(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return en(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ms(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class Ts extends Cs{}function Es(t){return t*(Math.PI/180)}function Rs(t){return 180*t/Math.PI}const Ps=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-cs;)t+=cs;else if(t>0)for(;t>cs;)t-=cs;return t},Bs=Ps;function Is(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Ds(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class Ls{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new Ls,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ls;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ls(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=Rs(r.rotateDeg),r}}function Os(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Fs(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const zs=/^#([0-9a-f]{3,8})$/,Hs={transparent:4294967040},js={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ns(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Vs(t){return rn(t)?new Us(t>>16,t>>8&255,255&t,1):en(t)?new Us(t[0],t[1],t[2]):new Us(255,255,255)}let Ws=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(Ki(Hs[t]))return function(t){return rn(t)?new Us(t>>>24,t>>>16&255,t>>>8&255,255&t):en(t)?new Us(t[0],t[1],t[2],t[3]):new Us(255,255,255,1)}(Hs[t]);if(Ki(js[t]))return Vs(js[t]);const e=`${t}`.trim().toLowerCase(),i=zs.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Us((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Vs(t):8===e?new Us(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Us(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Os(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Us(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new Us(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Fs(this.color.r,this.color.g,this.color.b),r=Os(Xi(t)?s.h:Kn(t,0,360),Xi(e)?s.s:e>=0&&e<=1?100*e:e,Xi(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new Us(r.r,r.g,r.b,n),this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}};class Us{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),Ki(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${Ns(this.r)+Ns(this.g)+Ns(this.b)+(1===this.opacity?"":Ns(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Fs(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Gs(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new Us(e,c,d,l*(1-t)+h*t)}},rgbToHex:Ys,rgbToHsl:Fs});function Xs(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Ks,qs,Zs,Js,Qs,tr,er,ir;function nr(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}var rr;function ar(t,e,i){return!(t&&e&&(i?(Ks=t.x1,qs=t.x2,Zs=t.y1,Js=t.y2,Qs=e.x1,tr=e.x2,er=e.y1,ir=e.y2,Ks>qs&&([Ks,qs]=[qs,Ks]),Zs>Js&&([Zs,Js]=[Js,Zs]),Qs>tr&&([Qs,tr]=[tr,Qs]),er>ir&&([er,ir]=[ir,er]),Ks>tr||qsir||Jse.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function hr(t){return t/180*Math.PI}function cr(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function dr(t,e){const i=e?t.angle:hr(t.angle),n=cr(t);return[lr({x:t.x1,y:t.y1},i,n),lr({x:t.x2,y:t.y1},i,n),lr({x:t.x2,y:t.y2},i,n),lr({x:t.x1,y:t.y2},i,n)]}let ur,pr,gr,fr;function mr(t){return ur=1/0,pr=1/0,gr=-1/0,fr=-1/0,t.forEach((t=>{ur>t.x&&(ur=t.x),grt.y&&(pr=t.y),fre&&r>n||rs?o:0}function xr(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class wr{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),Ki(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=Ki(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(Xi(this._canvas)&&(Ki(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),Xi(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&Ki(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),Xi(this._context)&&Ki(this._canvas)){const t=this._canvas.getContext("2d");Ki(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!Xi(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(Xi(t))return{width:0,height:0};if(Xi(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(Xi(this._numberCharSize)){const t=this._standardMethod(wr.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/wr.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return Xi(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(wr.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(Xi(this._letterCharSize)){const t=this._standardMethod(wr.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/wr.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return Ki(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){Ki(this._canvas)&&(this._canvas=null),Ki(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}wr.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",wr.NUMBERS_CHAR_SET="0123456789",wr.FULL_SIZE_CHAR="字";const Ar="undefined"!=typeof console;function kr(t,e,i){const n=[e].concat([].slice.call(i));Ar&&console[t].apply(console,n)}var Mr;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(Mr||(Mr={}));let Cr=class t{static getInstance(e,i){return t._instance&&rn(e)?t._instance.level(e):t._instance||(t._instance=new t(e,i)),t._instance}static setInstance(e){return t._instance=e}static setInstanceLevel(e){t._instance?t._instance.level(e):t._instance=new t(e)}static clearInstance(){t._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mr.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Mr.Info}canLogDebug(){return this._level>=Mr.Debug}canLogError(){return this._level>=Mr.Error}canLogWarn(){return this._level>=Mr.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Mr.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):kr(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Mr.Warn&&kr(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Mr.Info&&kr(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Mr.Debug&&kr(this._method||"log","DEBUG",e),this}};function Tr(t){if(an(t))return[t,t,t,t];if(en(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(qi(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Er(t){return t?"getUTCFullYear":"getFullYear"}function Rr(t){return t?"getUTCMonth":"getMonth"}function Pr(t){return t?"getUTCDate":"getDate"}function Br(t){return t?"getUTCHours":"getHours"}function Ir(t){return t?"getUTCMinutes":"getMinutes"}function Dr(t){return t?"getUTCSeconds":"getSeconds"}function Lr(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Or(t){return t?"setUTCFullYear":"setFullYear"}Cr._instance=null;const Fr=1e3,zr=6e4,Hr=36e5,jr=24*Hr,Nr=31*jr,Vr=365*jr,Wr=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),Ur=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),Gr=(t,e)=>e.getFullYear()-t.getFullYear(),Yr=t=>t.getFullYear(),$r=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),Xr=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),Kr=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),qr=t=>t.getUTCFullYear(),Zr=t=>(t.setDate(1),t.setHours(0,0,0,0),t),Jr=(t,e)=>(t.setMonth(t.getMonth()+e),t),Qr=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),ta=t=>t.getMonth(),ea=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),ia=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),na=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),sa=t=>t.getUTCMonth(),ra=t=>(t.setHours(0,0,0,0),t),aa=(t,e)=>(t.setDate(t.getDate()+e),t),oa=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/jr,la=t=>t.getDate()-1,ha=t=>(t.setUTCHours(0,0,0,0),t),ca=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),da=(t,e)=>(+e-+t)/jr,ua=t=>t.getUTCDate()-1,pa=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),ga=(t,e)=>(t.setHours(t.getHours()+e),t),fa=(t,e)=>(+e-+t)/Hr,ma=t=>t.getHours(),ya=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),_a=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),va=t=>t.getUTCHours(),ba=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),xa=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Sa=(t,e)=>(+e-+t)/6e4,wa=t=>t.getMinutes(),Aa=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),ka=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Ma=t=>t.getUTCMinutes(),Ca=t=>(t.setTime(+t-t.getMilliseconds()),t),Ta=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ea=(t,e)=>(+e-+t)/1e3,Ra=t=>t.getSeconds(),Pa=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),Ba=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ia=t=>t.getUTCSeconds(),Da=t=>t,La=(t,e)=>(t.setTime(+t+e),t),Oa=(t,e)=>+e-+t,Fa=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},za=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Fa(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Fa(h,c)}};function Ha(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function ja(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var Na=6371008.8,Va={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*Na,kilometers:6371.0088,kilometres:6371.0088,meters:Na,metres:Na,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Na/1852,radians:1,yards:6967335.223679999};function Wa(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function Ua(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function Ga(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(Ks=e.x1,qs=e.x2,Zs=e.y1,Js=e.y2,Ks>qs&&([Ks,qs]=[qs,Ks]),Zs>Js&&([Zs,Js]=[Js,Zs]),t.x>=Ks&&t.x<=qs&&t.y>=Zs&&t.y<=Js):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function Ya(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Es(t[0]),r=Es(t[1]),a=Es(i),o=function(t,e){void 0===e&&(e="kilometers");var i=Va[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Rs(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Rs(l)}}const $a=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n{const i=$a(qa,e),{tolerance:n}=i;return Vi(t,n)};var Ja;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Ja||(Ja={}));const Qa=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},to=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+ro(e,6):ro(e,4))+"-"+ro(t.getUTCMonth()+1,2)+"-"+ro(t.getUTCDate(),2)+(r?"T"+ro(i,2)+":"+ro(n,2)+":"+ro(s,2)+"."+ro(r,3)+"Z":s?"T"+ro(i,2)+":"+ro(n,2)+":"+ro(s,2)+"Z":n||i?"T"+ro(i,2)+":"+ro(n,2)+"Z":"")}function oo(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return io;if(h)return h=!1,eo;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Ja.DSV;const i=$a(co,e),{delimiter:n}=i;if(!tn(n))throw new TypeError("Invalid delimiter: must be a string!");return oo(n).parse(t)},po=function(t){return(arguments.length>2?arguments[2]:void 0).type=Ja.DSV,lo(t)},go=function(t){return(arguments.length>2?arguments[2]:void 0).type=Ja.DSV,ho(t)};function fo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return mo(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return mo(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return _o(t);default:throw new Error("unknown GeoJSON type")}}function mo(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=yo(t.properties),e.geometry=_o(t.geometry),e}function yo(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=yo(n):e[i]=n})),e):e}function _o(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return _o(t)})),e):(e.coordinates=vo(t.coordinates),e)}function vo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return vo(t)}))}function bo(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function xo(t){for(var e,i,n=bo(t),s=0,r=1;r0}function So(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=fo(t));var r=[];switch(t.type){case"GeometryCollection":return wo(t,(function(t){ko(t,n)})),t;case"FeatureCollection":return So(t,(function(t){So(ko(t,n),(function(t){r.push(t)}))})),Ua(r)}return ko(t,n)}function ko(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return wo(t,(function(t){ko(t,e)})),t;case"LineString":return Mo(bo(t),e),t;case"Polygon":return Co(bo(t),e),t;case"MultiLineString":return bo(t).forEach((function(t){Mo(t,e)})),t;case"MultiPolygon":return bo(t).forEach((function(t){Co(t,e)})),t;case"Point":case"MultiPoint":return t}}function Mo(t,e){xo(t)===e&&t.reverse()}function Co(t,e){xo(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=To(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Bo=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Ja.GEO;const i=$a(Ro,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Po(t))})):e.push(Po(t))})),e})(t);let o=t.features;return a&&(o=Ao(t,{reverse:!qi(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Eo.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Eo.bounds(t);t.bbox=e}})),t.features=o,t},Io={},Do=(t,e,i)=>{i.type=Ja.GEO;const n=$a(Ro,Io,e),{object:s}=n;if(!tn(s))throw new TypeError("Invalid object: must be a string!");const r=Ci(t,t.objects[s]);return Bo(r,n,i)},Lo=(t,e,i)=>{const n=!Yi(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!en(t))throw new TypeError("Invalid data: must be DataView array!");return en(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Oo=0;function Fo(){return Oo>1e8&&(Oo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+Oo++}class zo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new Ui,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Fo("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){this.transformMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const Ho="_data-view-diff-rank";class jo{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new Ui,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Fo("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",to),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=yn(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=yn(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[Ho]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[Ho]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[Ho][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear};utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear};parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1};parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1};parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1};parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1};parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1};parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1};parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1};parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Vo(t,e){const i=new Set(Cn(t)),n=new Set(Cn(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Wo}=$s,Uo=(t,e)=>($i(Yo.warnHandler)&&Yo.warnHandler.call(null,t,e),e?Cr.getInstance().warn(`[VChart warn]: ${t}`,e):Cr.getInstance().warn(`[VChart warn]: ${t}`)),Go=(t,e,i)=>{const n=new Error(t);return Cr.getInstance().error(`[VChart error]: ${n}`,e)},Yo={silent:!1,warnHandler:!1,errorHandler:!1},$o="undefined"!=typeof window&&void 0!==window.document,Xo=$o&&globalThis.document;function Ko(t){return("desktop-browser"===t||"mobile-browser"===t)&&$o}function qo(t){return"miniApp"===t||"mobile-browser"===t}function Zo(t){return t.includes("miniApp")||"lynx"===t}let Jo=0;function Qo(){return Jo>=9999999&&(Jo=0),Jo++}function tl(t){return!Xi(t)&&(!!rn(t)||+t==+t)}function el(t){return!(!t||0===t.length)&&(!Xi(t[0])&&!Xi(t[0].dataId)&&en(t[0].fields))}const il=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const nl=t=>e=>pn(e,t);function sl(t,e,i){const n=[e].concat([].slice.call(i));console[t].apply(console,n)}var rl;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rl||(rl={}));class al{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rl.None,e=arguments.length>1?arguments[1]:void 0;this._level=t,this._method=e}canLogInfo(){return this._level>=rl.Info}canLogDebug(){return this._level>=rl.Debug}canLogError(){return this._level>=rl.Error}canLogWarn(){return this._level>=rl.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=rl.Error&&sl(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rl.Warn&&sl(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rl.Info&&sl(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rl.Debug&&sl(this._method||"log","DEBUG",e),this}}let ol=null;const ll=(t,e)=>(ol&&rn(t)?ol.level(t):ol||(ol=new al(t,e)),ol),hl=t=>{ll().error(t)},cl=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if($i(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||hl("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&hl("Access path missing closing bracket: "+t),a&&hl("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return il((i&&i.get||nl)(n),[s],e||s)},dl=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(en(t)){const n=t.map((t=>cl(t,e,i)));return t=>n.map((e=>e(t)))}return cl(t,e,i)};dl("id");const ul=il((function(t){return t}),[],"identity"),pl=il((function(){return 0}),[],"zero");il((function(){return 1}),[],"one"),il((function(){return!0}),[],"true"),il((function(){return!1}),[],"false"),il((function(){return{}}),[],"emptyObject");const gl=(t,e)=>{if((te||Xi(e))&&!Xi(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},fl=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>gl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=Cn(e)||[],s=[],r=[],a={},o=i.comparator||fl;return Cn(t).forEach(((t,e)=>{if(Xi(t))return;s.push("desc"===n[e]?-1:1);const o=$i(t)?t:dl(t,null,i);var l;r.push(o),(l=o,(Xi(l)?null:l.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:il(o(r,s),Object.keys(a))},yl=(t,e)=>{const i=$i(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(Xi(e)||Xi(i))return Xi(e)&&Xi(i);if(!Zi(e)&&!Zi(i))return e===i;const s=en(e)?e:e[t],r=en(i)?i:i[t];return s===r||!1!==n&&(en(r)?!(!en(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!qi(r)&&!(!qi(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>_l(t,r,s)))))},vl=(t,e)=>Xi(t)?e:Math.min(tn(t)?e*parseFloat(t)/100:t,e);function bl(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!Xi(s)&&(s=+s)>=s&&!Xi(r)&&(r=+r)>=r&&n(s,r,++a)}))}function xl(t,e,i,n,s){let r=0,a=0;return bl(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function Sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;bl(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:xl(t,e,i,s,h)}}const wl=Un;function Al(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const kl=t=>an(t)?Es(t):null,Ml=t=>an(t)?Rs(t):null;function Cl(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Tl(t,e,i,n){const s=Cl({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function El(t){return 3===t||4===t}function Rl(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}function Pl(t,e){const i=e?+t[0][e]:+t[0];if(!an(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return an(n)&&n{const n=e?+i[e]:+i;return an(n)&&n>t&&(t=n),t}),i)}function Il(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;an(s)&&(i+=s,n++)}));return i/n}function Dl(t,e){const i=Il(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Ll(t){let e="center",i="middle";return e=(t=Al(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}}function Ol(t,e){const i=Fl(t),n=Fl(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function Fl(t,e={x:0,y:0}){return ks.distancePP(t,e)}function zl(t,e,i){let n=!1;if(e&&$i(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function Hl(t){return function(e){let i;return i=en(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var jl;function Nl(t){switch(t){case jl.Linear:case jl.Log:case jl.Pow:case jl.Sqrt:case jl.Symlog:case jl.Time:return!0;default:return!1}}function Vl(t){switch(t){case jl.Linear:case jl.Log:case jl.Pow:case jl.Sqrt:case jl.Symlog:case jl.Time:case jl.Ordinal:case jl.Point:case jl.Band:return!0;default:return!1}}function Wl(t){switch(t){case jl.Ordinal:case jl.Point:case jl.Band:return!0;default:return!1}}!function(t){t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(jl||(jl={}));class Ul{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Gl=Symbol("implicit");class Yl extends Ul{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=jl.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Gl}clone(){return(new Yl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!Xi(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==Gl)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Kl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),ql=t=>t<0?-t*t:t*t,Zl=t=>-Math.log(-t),Jl=t=>-Math.exp(-t),Ql=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,th=t=>10===t?Ql:t===Math.E?Math.exp:e=>Math.pow(t,e),eh=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),ih=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),nh=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function sh(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function rh(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function ah(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class hh extends Yl{constructor(t){super(),this.type=jl.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Bn(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[Dn(t[0]),Dn(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[Dn(t[0]),Dn(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:lh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return lh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=Zn(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}clone(){return new hh(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:ch}=$s;function dh(t,e){const i=typeof e;let n;if(Xi(e)||"boolean"===i)return()=>e;if("number"===i)return es(t,e);if("string"===i){if(n=Ws.parseColorString(e)){const e=ch(Ws.parseColorString(t),n);return t=>e(t).formatRgb()}return es(Number(t),Number(e))}return e instanceof Us?ch(t,e):e instanceof Ws?ch(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):es(Number(t),Number(e))}class uh extends Ul{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$l,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$l;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=$l,this._piecewise=rh,this._interpolate=dh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),es)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,Dn);return this._domain=i,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=is,this.rescale(e)}rescale(t){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=Zn(this._domain[0],this._domain[n-1])),this._piecewise=n>2?ah:rh,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:$l),this.rescale(i)):this._clamp!==$l}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ph=Math.sqrt(50),gh=Math.sqrt(10),fh=Math.sqrt(2);function mh(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=ph?a=10:r>=gh?a=5:r>=fh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function _h(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=yh(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class xh extends uh{constructor(){super(...arguments),this.type=jl.Linear}clone(){return(new xh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return _h(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return vh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=bh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=bh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=bh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function Sh(t){return e=>-t(-e)}class wh extends uh{constructor(){super(eh(10),th(10)),this.type=jl.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new wh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){if(t)return this;super.rescale();const e=eh(this._base),i=th(this._base);return this._domain[0]<0?(this._logs=Sh(e),this._pows=Sh(i),this.transformer=Zl,this.untransformer=Jl):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return $l}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.lengththis._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}}class Ah extends hh{constructor(t){super(!1),this.type=jl.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class kh extends xh{constructor(){super(),this.type=jl.Pow,this._exponent=1}clone(){return(new kh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=$l,this.untransformer=$l):.5===this._exponent?(this.transformer=Kl,this.untransformer=ql):(this.transformer=Xl(this._exponent),this.untransformer=Xl(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function Mh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class Ch{constructor(){this.type=jl.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return Mh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new Th).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return mh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return _h(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return vh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=bh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=bh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=bh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class Eh extends xh{constructor(){super(Kl,ql),this.type=jl.Sqrt}clone(){return(new Eh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Rh extends xh{constructor(){super(ih(1),nh(1)),this.type=jl.Symlog,this._const=1}clone(){return(new Rh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=ih(t),this.untransformer=nh(t),this.rescale(e)):this._const}}class Ph{constructor(){this.type=jl.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!Xi(t)&&an(+t)?this._range[On(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new Ph).domain(this._domain).range(this._range).unknown(this._unknown)}}const Bh=[["second",1,Fr],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,zr],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,Hr],["hour",3,3*Hr],["hour",6,6*Hr],["hour",12,12*Hr],["day",1,jr],["day",2,2*jr],["day",7,7*jr],["month",1,Nr],["month",3,3*Nr],["month",6,6*Nr],["year",1,365*jr]];function Ih(t){return+as(t)}function Dh(t,e,i,n){const s=(+e-+t)/i,r=On(Bh.map((t=>t[2])),s);if(r===Bh.length){const s=Math.max(Nn(+t/Vr,+e/Vr,i),1),r=t=>(t[Or(n)](Math.floor(t[Er(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Or(n)](t[Er(n)]()+e*s),t);return{floor:r,offset:a,ceil:Fa(r,a)}}if(0===r){const n=Math.max(Nn(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Fa(s,r)}}const[a,o]=Bh[s/Bh[r-1][2]"year"===t&&e?{floor:$r,offset:Xr,count:Kr,field:qr}:"month"===t&&e?{floor:ea,offset:ia,count:na,field:sa}:"day"===t&&e?{floor:ha,offset:ca,count:da,field:ua}:"hour"===t&&e?{floor:ya,offset:_a,count:fa,field:va}:"minute"===t&&e?{floor:Aa,offset:ka,count:Sa,field:Ma}:"second"===t&&e?{floor:Pa,offset:Ba,count:Ea,field:Ia}:"year"===t?{floor:Wr,offset:Ur,count:Gr,field:Yr}:"month"===t?{floor:Zr,offset:Jr,count:Qr,field:ta}:"day"===t?{floor:ra,offset:aa,count:oa,field:la}:"hour"===t?{floor:pa,offset:ga,count:fa,field:ma}:"minute"===t?{floor:ba,offset:xa,count:Sa,field:wa}:"second"===t?{floor:Ca,offset:Ta,count:Ea,field:Ra}:{floor:Da,offset:La,count:Oa})(a,n);return za(o,l)}class Lh extends uh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=jl.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(as);const i=Array.from(t,Ih);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=as(t),s=e[Er(n)](),r=e[Rr(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Pr(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[Br(n)](),c=(h-1)%12+1,d=e[Ir(n)](),u=e[Dr(n)](),p=e[Lr(n)]();return(i||"").replace(/YYYY/g,Xn(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,Xn(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,Xn(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,Xn(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,Xn(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,Xn(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,Xn(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,Xn(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Lh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(rn(t)||Xi(t))&&(i=Dh(e[0],e[e.length-1],Xi(t)?10:t,this._isUtc)),i&&this.domain(oh(e,i)),this}utc(){return this._isUtc}}function Oh(t,e){const i=Ki(e)?t?.[e]??t?.default:t?.default;if(!i||en(i))return i;if(qi(i)){const{dataScheme:n}=i;return n?Nh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>jh(i)?zh(t,i,e):i)).filter(Ki)}))):n.map((i=>jh(i)?zh(t,i,e):i)).filter(Ki):[]}return[]}function Fh(t,e){return Nh(t)?t.find((t=>Ki(t.isAvailable)?$i(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!Ki(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function zh(t,e,i){const n=Ki(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!Ki(e.a)&&!Ki(e.l)||!tn(s))return s;let r=new Wo(s);if(Ki(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Fs(t,i,n),o=Os(s,a,e.l),l=new Wo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return Ki(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Hh=(t,e,i)=>{if(jh(t)&&e){const n=zh(e,t,i);if(n)return n}return t};function jh(t){return qi(t)&&"palette"===t.type&&!!t.key}function Nh(t){return!!en(t)&&t.every((t=>Ki(t.scheme)))}class Vh extends Yl{_range;range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Nh(this._range))return void super.range(this._range);const t=Fh(this._range,this._domain);super.range(t)}}const Wh={linear:xh,band:hh,point:Ah,ordinal:Yl,threshold:Ph,colorOrdinal:Vh};function Uh(t){const e=Wh[t];return e?new e:null}function Gh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Yh(t){return Ki(t?.field)&&Ki(t?.scale)}var $h;function Xh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Kh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function qh(t){return!!tn(t)&&(!!t.endsWith("%")&&tl(t.substring(0,t.length-1)))}function Zh(t,e,i){return rn(t)?t:qh(t)?Number(t.substring(0,t.length-1))*e/100:$i(t)?t(i):0}function Jh(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>rn(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=Zh(t[s],e.size,i)}))})),n}function Qh(t){let e={};return en(t)?(Xi(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),Xi(t[1])||(e.left=e.right=t[1]),Xi(t[2])||(e.bottom=t[2]),Xi(t[3])||(e.left=t[3]),e):rn(t)||qh(t)||$i(t)?(e.top=e.left=e.bottom=e.right=t,e):(qi(t)&&(e={...t}),e)}function tc(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function ec(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=ec(t[n],e)}return i}return en(t)?t.map((t=>ec(t,e))):t}function ic(t){const e=t;let i;if(!Ki(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof jo||e.every((t=>i.includes(t)))}(e))return e;const n=en(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:Yi(e)||rn(e)||tn(e)?e:sn(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=ic(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}($h||($h={}));var nc=function(t){return t&&t.Math==Math&&t},sc=nc("object"==typeof globalThis&&globalThis)||nc("object"==typeof window&&window)||nc("object"==typeof self&&self)||nc("object"==typeof ni&&ni)||function(){return this}()||ni||Function("return this")(),rc={},ac=function(t){try{return!!t()}catch(t){return!0}},oc=!ac((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),lc=!ac((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),hc=lc,cc=Function.prototype.call,dc=hc?cc.bind(cc):function(){return cc.apply(cc,arguments)},uc={},pc={}.propertyIsEnumerable,gc=Object.getOwnPropertyDescriptor,fc=gc&&!pc.call({1:2},1);uc.f=fc?function(t){var e=gc(this,t);return!!e&&e.enumerable}:pc;var mc,yc,_c=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},vc=lc,bc=Function.prototype,xc=bc.call,Sc=vc&&bc.bind.bind(xc,xc),wc=vc?Sc:function(t){return function(){return xc.apply(t,arguments)}},Ac=wc,kc=Ac({}.toString),Mc=Ac("".slice),Cc=function(t){return Mc(kc(t),8,-1)},Tc=ac,Ec=Cc,Rc=Object,Pc=wc("".split),Bc=Tc((function(){return!Rc("z").propertyIsEnumerable(0)}))?function(t){return"String"==Ec(t)?Pc(t,""):Rc(t)}:Rc,Ic=function(t){return null==t},Dc=Ic,Lc=TypeError,Oc=function(t){if(Dc(t))throw Lc("Can't call method on "+t);return t},Fc=Bc,zc=Oc,Hc=function(t){return Fc(zc(t))},jc="object"==typeof document&&document.all,Nc={all:jc,IS_HTMLDDA:void 0===jc&&void 0!==jc},Vc=Nc.all,Wc=Nc.IS_HTMLDDA?function(t){return"function"==typeof t||t===Vc}:function(t){return"function"==typeof t},Uc=Wc,Gc=Nc.all,Yc=Nc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Uc(t)||t===Gc}:function(t){return"object"==typeof t?null!==t:Uc(t)},$c=sc,Xc=Wc,Kc=function(t,e){return arguments.length<2?(i=$c[t],Xc(i)?i:void 0):$c[t]&&$c[t][e];var i},qc=wc({}.isPrototypeOf),Zc=sc,Jc="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Qc=Zc.process,td=Zc.Deno,ed=Qc&&Qc.versions||td&&td.version,id=ed&&ed.v8;id&&(yc=(mc=id.split("."))[0]>0&&mc[0]<4?1:+(mc[0]+mc[1])),!yc&&Jc&&(!(mc=Jc.match(/Edge\/(\d+)/))||mc[1]>=74)&&(mc=Jc.match(/Chrome\/(\d+)/))&&(yc=+mc[1]);var nd=yc,sd=ac,rd=sc.String,ad=!!Object.getOwnPropertySymbols&&!sd((function(){var t=Symbol();return!rd(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&nd&&nd<41})),od=ad&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ld=Kc,hd=Wc,cd=qc,dd=Object,ud=od?function(t){return"symbol"==typeof t}:function(t){var e=ld("Symbol");return hd(e)&&cd(e.prototype,dd(t))},pd=String,gd=function(t){try{return pd(t)}catch(t){return"Object"}},fd=Wc,md=gd,yd=TypeError,_d=function(t){if(fd(t))return t;throw yd(md(t)+" is not a function")},vd=_d,bd=Ic,xd=function(t,e){var i=t[e];return bd(i)?void 0:vd(i)},Sd=dc,wd=Wc,Ad=Yc,kd=TypeError,Md={exports:{}},Cd=sc,Td=Object.defineProperty,Ed=function(t,e){try{Td(Cd,t,{value:e,configurable:!0,writable:!0})}catch(i){Cd[t]=e}return e},Rd=Ed,Pd="__core-js_shared__",Bd=sc[Pd]||Rd(Pd,{}),Id=Bd;(Md.exports=function(t,e){return Id[t]||(Id[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Dd=Md.exports,Ld=Oc,Od=Object,Fd=function(t){return Od(Ld(t))},zd=Fd,Hd=wc({}.hasOwnProperty),jd=Object.hasOwn||function(t,e){return Hd(zd(t),e)},Nd=wc,Vd=0,Wd=Math.random(),Ud=Nd(1..toString),Gd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Ud(++Vd+Wd,36)},Yd=Dd,$d=jd,Xd=Gd,Kd=ad,qd=od,Zd=sc.Symbol,Jd=Yd("wks"),Qd=qd?Zd.for||Zd:Zd&&Zd.withoutSetter||Xd,tu=function(t){return $d(Jd,t)||(Jd[t]=Kd&&$d(Zd,t)?Zd[t]:Qd("Symbol."+t)),Jd[t]},eu=dc,iu=Yc,nu=ud,su=xd,ru=function(t,e){var i,n;if("string"===e&&wd(i=t.toString)&&!Ad(n=Sd(i,t)))return n;if(wd(i=t.valueOf)&&!Ad(n=Sd(i,t)))return n;if("string"!==e&&wd(i=t.toString)&&!Ad(n=Sd(i,t)))return n;throw kd("Can't convert object to primitive value")},au=TypeError,ou=tu("toPrimitive"),lu=function(t,e){if(!iu(t)||nu(t))return t;var i,n=su(t,ou);if(n){if(void 0===e&&(e="default"),i=eu(n,t,e),!iu(i)||nu(i))return i;throw au("Can't convert object to primitive value")}return void 0===e&&(e="number"),ru(t,e)},hu=ud,cu=function(t){var e=lu(t,"string");return hu(e)?e:e+""},du=Yc,uu=sc.document,pu=du(uu)&&du(uu.createElement),gu=function(t){return pu?uu.createElement(t):{}},fu=gu,mu=!oc&&!ac((function(){return 7!=Object.defineProperty(fu("div"),"a",{get:function(){return 7}}).a})),yu=oc,_u=dc,vu=uc,bu=_c,xu=Hc,Su=cu,wu=jd,Au=mu,ku=Object.getOwnPropertyDescriptor;rc.f=yu?ku:function(t,e){if(t=xu(t),e=Su(e),Au)try{return ku(t,e)}catch(t){}if(wu(t,e))return bu(!_u(vu.f,t,e),t[e])};var Mu={},Cu=oc&&ac((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Tu=Yc,Eu=String,Ru=TypeError,Pu=function(t){if(Tu(t))return t;throw Ru(Eu(t)+" is not an object")},Bu=oc,Iu=mu,Du=Cu,Lu=Pu,Ou=cu,Fu=TypeError,zu=Object.defineProperty,Hu=Object.getOwnPropertyDescriptor,ju="enumerable",Nu="configurable",Vu="writable";Mu.f=Bu?Du?function(t,e,i){if(Lu(t),e=Ou(e),Lu(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Vu in i&&!i[Vu]){var n=Hu(t,e);n&&n[Vu]&&(t[e]=i.value,i={configurable:Nu in i?i[Nu]:n[Nu],enumerable:ju in i?i[ju]:n[ju],writable:!1})}return zu(t,e,i)}:zu:function(t,e,i){if(Lu(t),e=Ou(e),Lu(i),Iu)try{return zu(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Fu("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var Wu=Mu,Uu=_c,Gu=oc?function(t,e,i){return Wu.f(t,e,Uu(1,i))}:function(t,e,i){return t[e]=i,t},Yu={exports:{}},$u=oc,Xu=jd,Ku=Function.prototype,qu=$u&&Object.getOwnPropertyDescriptor,Zu=Xu(Ku,"name"),Ju={EXISTS:Zu,PROPER:Zu&&"something"===function(){}.name,CONFIGURABLE:Zu&&(!$u||$u&&qu(Ku,"name").configurable)},Qu=Wc,tp=Bd,ep=wc(Function.toString);Qu(tp.inspectSource)||(tp.inspectSource=function(t){return ep(t)});var ip,np,sp,rp=tp.inspectSource,ap=Wc,op=sc.WeakMap,lp=ap(op)&&/native code/.test(String(op)),hp=Gd,cp=Dd("keys"),dp=function(t){return cp[t]||(cp[t]=hp(t))},up={},pp=lp,gp=sc,fp=Yc,mp=Gu,yp=jd,_p=Bd,vp=dp,bp=up,xp="Object already initialized",Sp=gp.TypeError,wp=gp.WeakMap;if(pp||_p.state){var Ap=_p.state||(_p.state=new wp);Ap.get=Ap.get,Ap.has=Ap.has,Ap.set=Ap.set,ip=function(t,e){if(Ap.has(t))throw Sp(xp);return e.facade=t,Ap.set(t,e),e},np=function(t){return Ap.get(t)||{}},sp=function(t){return Ap.has(t)}}else{var kp=vp("state");bp[kp]=!0,ip=function(t,e){if(yp(t,kp))throw Sp(xp);return e.facade=t,mp(t,kp,e),e},np=function(t){return yp(t,kp)?t[kp]:{}},sp=function(t){return yp(t,kp)}}var Mp={set:ip,get:np,has:sp,enforce:function(t){return sp(t)?np(t):ip(t,{})},getterFor:function(t){return function(e){var i;if(!fp(e)||(i=np(e)).type!==t)throw Sp("Incompatible receiver, "+t+" required");return i}}},Cp=wc,Tp=ac,Ep=Wc,Rp=jd,Pp=oc,Bp=Ju.CONFIGURABLE,Ip=rp,Dp=Mp.enforce,Lp=Mp.get,Op=String,Fp=Object.defineProperty,zp=Cp("".slice),Hp=Cp("".replace),jp=Cp([].join),Np=Pp&&!Tp((function(){return 8!==Fp((function(){}),"length",{value:8}).length})),Vp=String(String).split("String"),Wp=Yu.exports=function(t,e,i){"Symbol("===zp(Op(e),0,7)&&(e="["+Hp(Op(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Rp(t,"name")||Bp&&t.name!==e)&&(Pp?Fp(t,"name",{value:e,configurable:!0}):t.name=e),Np&&i&&Rp(i,"arity")&&t.length!==i.arity&&Fp(t,"length",{value:i.arity});try{i&&Rp(i,"constructor")&&i.constructor?Pp&&Fp(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Dp(t);return Rp(n,"source")||(n.source=jp(Vp,"string"==typeof e?e:"")),t};Function.prototype.toString=Wp((function(){return Ep(this)&&Lp(this).source||Ip(this)}),"toString");var Up=Yu.exports,Gp=Wc,Yp=Mu,$p=Up,Xp=Ed,Kp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Gp(i)&&$p(i,r,n),n.global)s?t[e]=i:Xp(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Yp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},qp={},Zp=Math.ceil,Jp=Math.floor,Qp=Math.trunc||function(t){var e=+t;return(e>0?Jp:Zp)(e)},tg=function(t){var e=+t;return e!=e||0===e?0:Qp(e)},eg=tg,ig=Math.max,ng=Math.min,sg=function(t,e){var i=eg(t);return i<0?ig(i+e,0):ng(i,e)},rg=tg,ag=Math.min,og=function(t){return t>0?ag(rg(t),9007199254740991):0},lg=function(t){return og(t.length)},hg=Hc,cg=sg,dg=lg,ug=function(t){return function(e,i,n){var s,r=hg(e),a=dg(r),o=cg(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},pg={includes:ug(!0),indexOf:ug(!1)},gg=jd,fg=Hc,mg=pg.indexOf,yg=up,_g=wc([].push),vg=function(t,e){var i,n=fg(t),s=0,r=[];for(i in n)!gg(yg,i)&&gg(n,i)&&_g(r,i);for(;e.length>s;)gg(n,i=e[s++])&&(~mg(r,i)||_g(r,i));return r},bg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],xg=vg,Sg=bg.concat("length","prototype");qp.f=Object.getOwnPropertyNames||function(t){return xg(t,Sg)};var wg={};wg.f=Object.getOwnPropertySymbols;var Ag=Kc,kg=qp,Mg=wg,Cg=Pu,Tg=wc([].concat),Eg=Ag("Reflect","ownKeys")||function(t){var e=kg.f(Cg(t)),i=Mg.f;return i?Tg(e,i(t)):e},Rg=jd,Pg=Eg,Bg=rc,Ig=Mu,Dg=ac,Lg=Wc,Og=/#|\.prototype\./,Fg=function(t,e){var i=Hg[zg(t)];return i==Ng||i!=jg&&(Lg(e)?Dg(e):!!e)},zg=Fg.normalize=function(t){return String(t).replace(Og,".").toLowerCase()},Hg=Fg.data={},jg=Fg.NATIVE="N",Ng=Fg.POLYFILL="P",Vg=Fg,Wg=sc,Ug=rc.f,Gg=Gu,Yg=Kp,$g=Ed,Xg=function(t,e,i){for(var n=Pg(e),s=Ig.f,r=Bg.f,a=0;ar;r++)if((o=y(t[r]))&&wm(Em,o))return o;return new Tm(!1)}n=Am(t,s)}for(l=u?t.next:n.next;!(h=_m(l,n)).done;){try{o=y(h.value)}catch(t){Mm(n,"throw",t)}if("object"==typeof o&&o&&wm(Em,o))return o}return new Tm(!1)},Pm=qc,Bm=TypeError,Im=function(t,e){if(Pm(e,t))return t;throw Bm("Incorrect invocation")},Dm=tu("iterator"),Lm=!1;try{var Om=0,Fm={next:function(){return{done:!!Om++}},return:function(){Lm=!0}};Fm[Dm]=function(){return this},Array.from(Fm,(function(){throw 2}))}catch(hl){}var zm=Mu.f,Hm=jd,jm=tu("toStringTag"),Nm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Hm(t,jm)&&zm(t,jm,{configurable:!0,value:e})},Vm=wc,Wm=_d,Um=Wc,Gm=String,Ym=TypeError,$m=function(t,e,i){try{return Vm(Wm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Xm=Pu,Km=function(t){if("object"==typeof t||Um(t))return t;throw Ym("Can't set "+Gm(t)+" as a prototype")},qm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=$m(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Xm(i),Km(n),e?t(i,n):i.__proto__=n,i}}():void 0),Zm=Wc,Jm=Yc,Qm=qm,ty=qg,ey=sc,iy=wc,ny=Vg,sy=Kp,ry=Of,ay=Rm,oy=Im,ly=Wc,hy=Ic,cy=Yc,dy=ac,uy=function(t,e){if(!e&&!Lm)return!1;var i=!1;try{var n={};n[Dm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},py=Nm,gy=function(t,e,i){var n,s;return Qm&&Zm(n=e.constructor)&&n!==i&&Jm(s=n.prototype)&&s!==i.prototype&&Qm(t,s),t},fy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=ey[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=iy(o[t]);sy(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!cy(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!cy(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!cy(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ny(t,!ly(a)||!(s||o.forEach&&!dy((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),ry.enable();else if(ny(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=dy((function(){d.has(1)})),g=uy((function(t){new a(t)})),f=!s&&dy((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){oy(t,o);var i=gy(new a,t,l);return hy(e)||ay(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,ty({global:!0,constructor:!0,forced:l!=a},h),py(l,t),s||i.setStrong(l,t,n),l},my={},yy=vg,_y=bg,vy=Object.keys||function(t){return yy(t,_y)},by=oc,xy=Cu,Sy=Mu,wy=Pu,Ay=Hc,ky=vy;my.f=by&&!xy?Object.defineProperties:function(t,e){wy(t);for(var i,n=Ay(e),s=ky(e),r=s.length,a=0;r>a;)Sy.f(t,i=s[a++],n[i]);return t};var My,Cy=Kc("document","documentElement"),Ty=Pu,Ey=my,Ry=bg,Py=up,By=Cy,Iy=gu,Dy="prototype",Ly="script",Oy=dp("IE_PROTO"),Fy=function(){},zy=function(t){return"<"+Ly+">"+t+""},Hy=function(t){t.write(zy("")),t.close();var e=t.parentWindow.Object;return t=null,e},jy=function(){try{My=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;jy="undefined"!=typeof document?document.domain&&My?Hy(My):(e=Iy("iframe"),i="java"+Ly+":",e.style.display="none",By.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(zy("document.F=Object")),t.close(),t.F):Hy(My);for(var n=Ry.length;n--;)delete jy[Dy][Ry[n]];return jy()};Py[Oy]=!0;var Ny,Vy,Wy,Uy=Object.create||function(t,e){var i;return null!==t?(Fy[Dy]=Ty(t),i=new Fy,Fy[Dy]=null,i[Oy]=t):i=jy(),void 0===e?i:Ey.f(i,e)},Gy=Up,Yy=Mu,$y=function(t,e,i){return i.get&&Gy(i.get,e,{getter:!0}),i.set&&Gy(i.set,e,{setter:!0}),Yy.f(t,e,i)},Xy=Kp,Ky=function(t,e,i){for(var n in e)Xy(t,n,e[n],i);return t},qy=!ac((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Zy=jd,Jy=Wc,Qy=Fd,t_=qy,e_=dp("IE_PROTO"),i_=Object,n_=i_.prototype,s_=t_?i_.getPrototypeOf:function(t){var e=Qy(t);if(Zy(e,e_))return e[e_];var i=e.constructor;return Jy(i)&&e instanceof i?i.prototype:e instanceof i_?n_:null},r_=ac,a_=Wc,o_=Yc,l_=s_,h_=Kp,c_=tu("iterator"),d_=!1;[].keys&&("next"in(Wy=[].keys())?(Vy=l_(l_(Wy)))!==Object.prototype&&(Ny=Vy):d_=!0);var u_=!o_(Ny)||r_((function(){var t={};return Ny[c_].call(t)!==t}));u_&&(Ny={}),a_(Ny[c_])||h_(Ny,c_,(function(){return this}));var p_={IteratorPrototype:Ny,BUGGY_SAFARI_ITERATORS:d_},g_=p_.IteratorPrototype,f_=Uy,m_=_c,y_=Nm,__=Uf,v_=function(){return this},b_=qg,x_=dc,S_=Wc,w_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=f_(g_,{next:m_(+!n,i)}),y_(t,s,!1),__[s]=v_,t},A_=s_,k_=qm,M_=Nm,C_=Gu,T_=Kp,E_=Uf,R_=Ju.PROPER,P_=Ju.CONFIGURABLE,B_=p_.IteratorPrototype,I_=p_.BUGGY_SAFARI_ITERATORS,D_=tu("iterator"),L_="keys",O_="values",F_="entries",z_=function(){return this},H_=Kc,j_=$y,N_=oc,V_=tu("species"),W_=Uy,U_=$y,G_=Ky,Y_=Wf,$_=Im,X_=Ic,K_=Rm,q_=function(t,e,i,n,s,r,a){w_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!I_&&t in p)return p[t];switch(t){case L_:case O_:case F_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[D_]||p["@@iterator"]||s&&p[s],f=!I_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=A_(m.call(new t)))!==Object.prototype&&o.next&&(A_(o)!==B_&&(k_?k_(o,B_):S_(o[D_])||T_(o,D_,z_)),M_(o,d,!0)),R_&&s==O_&&g&&g.name!==O_&&(P_?C_(p,"name",O_):(u=!0,f=function(){return x_(g,this)})),s)if(l={values:c(O_),keys:r?f:c(L_),entries:c(F_)},a)for(h in l)(I_||u||!(h in p))&&T_(p,h,l[h]);else b_({target:e,proto:!0,forced:I_||u},l);return p[D_]!==f&&T_(p,D_,f,{name:s}),E_[e]=f,l},Z_=function(t,e){return{value:t,done:e}},J_=function(t){var e=H_(t);N_&&e&&!e[V_]&&j_(e,V_,{configurable:!0,get:function(){return this}})},Q_=oc,tv=Of.fastKey,ev=Mp.set,iv=Mp.getterFor,nv={getConstructor:function(t,e,i,n){var s=t((function(t,s){$_(t,r),ev(t,{type:e,index:W_(null),first:void 0,last:void 0,size:0}),Q_||(t.size=0),X_(s)||K_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=iv(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=tv(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),Q_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=tv(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return G_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,Q_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),Q_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=Y_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),G_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),Q_&&U_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=iv(e),r=iv(n);q_(t,e,(function(t,e){ev(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?Z_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,Z_(void 0,!0))}),i?"entries":"values",!i,!0),J_(e)}};fy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),nv);var sv=Cc,rv=Array.isArray||function(t){return"Array"==sv(t)},av=wc,ov=ac,lv=Wc,hv=em,cv=rp,dv=function(){},uv=[],pv=Kc("Reflect","construct"),gv=/^\s*(?:class|function)\b/,fv=av(gv.exec),mv=!gv.exec(dv),yv=function(t){if(!lv(t))return!1;try{return pv(dv,uv,t),!0}catch(t){return!1}},_v=function(t){if(!lv(t))return!1;switch(hv(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return mv||!!fv(gv,cv(t))}catch(t){return!0}};_v.sham=!0;var vv=!pv||ov((function(){var t;return yv(yv.call)||!yv(Object)||!yv((function(){t=!0}))||t}))?_v:yv,bv=rv,xv=vv,Sv=Yc,wv=tu("species"),Av=Array,kv=function(t){var e;return bv(t)&&(e=t.constructor,(xv(e)&&(e===Av||bv(e.prototype))||Sv(e)&&null===(e=e[wv]))&&(e=void 0)),void 0===e?Av:e},Mv=Wf,Cv=Bc,Tv=Fd,Ev=lg,Rv=function(t,e){return new(kv(t))(0===e?0:e)},Pv=wc([].push),Bv=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=Tv(l),f=Cv(g),m=Mv(h,c),y=Ev(f),_=0,v=d||Rv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Pv(b,u)}else switch(t){case 4:return!1;case 7:Pv(b,u)}return r?-1:n||s?s:b}},Iv={forEach:Bv(0),map:Bv(1),filter:Bv(2),some:Bv(3),every:Bv(4),find:Bv(5),findIndex:Bv(6),filterReject:Bv(7)},Dv=wc,Lv=Ky,Ov=Of.getWeakData,Fv=Im,zv=Pu,Hv=Ic,jv=Yc,Nv=Rm,Vv=jd,Wv=Mp.set,Uv=Mp.getterFor,Gv=Iv.find,Yv=Iv.findIndex,$v=Dv([].splice),Xv=0,Kv=function(t){return t.frozen||(t.frozen=new qv)},qv=function(){this.entries=[]},Zv=function(t,e){return Gv(t.entries,(function(t){return t[0]===e}))};qv.prototype={get:function(t){var e=Zv(this,t);if(e)return e[1]},has:function(t){return!!Zv(this,t)},set:function(t,e){var i=Zv(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Yv(this.entries,(function(e){return e[0]===t}));return~e&&$v(this.entries,e,1),!!~e}};var Jv,Qv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Fv(t,r),Wv(t,{type:e,id:Xv++,frozen:void 0}),Hv(s)||Nv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Uv(e),o=function(t,e,i){var n=a(t),s=Ov(zv(e),!0);return!0===s?Kv(n).set(e,i):s[n.id]=i,t};return Lv(r,{delete:function(t){var e=a(this);if(!jv(t))return!1;var i=Ov(t);return!0===i?Kv(e).delete(t):i&&Vv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!jv(t))return!1;var i=Ov(t);return!0===i?Kv(e).has(t):i&&Vv(i,e.id)}}),Lv(r,i?{get:function(t){var e=a(this);if(jv(t)){var i=Ov(t);return!0===i?Kv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},tb=bf,eb=sc,ib=wc,nb=Ky,sb=Of,rb=fy,ab=Qv,ob=Yc,lb=Mp.enforce,hb=ac,cb=lp,db=Object,ub=Array.isArray,pb=db.isExtensible,gb=db.isFrozen,fb=db.isSealed,mb=db.freeze,yb=db.seal,_b={},vb={},bb=!eb.ActiveXObject&&"ActiveXObject"in eb,xb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Sb=rb("WeakMap",xb,ab),wb=Sb.prototype,Ab=ib(wb.set);if(cb)if(bb){Jv=ab.getConstructor(xb,"WeakMap",!0),sb.enable();var kb=ib(wb.delete),Mb=ib(wb.has),Cb=ib(wb.get);nb(wb,{delete:function(t){if(ob(t)&&!pb(t)){var e=lb(this);return e.frozen||(e.frozen=new Jv),kb(this,t)||e.frozen.delete(t)}return kb(this,t)},has:function(t){if(ob(t)&&!pb(t)){var e=lb(this);return e.frozen||(e.frozen=new Jv),Mb(this,t)||e.frozen.has(t)}return Mb(this,t)},get:function(t){if(ob(t)&&!pb(t)){var e=lb(this);return e.frozen||(e.frozen=new Jv),Mb(this,t)?Cb(this,t):e.frozen.get(t)}return Cb(this,t)},set:function(t,e){if(ob(t)&&!pb(t)){var i=lb(this);i.frozen||(i.frozen=new Jv),Mb(this,t)?Ab(this,t,e):i.frozen.set(t,e)}else Ab(this,t,e);return this}})}else tb&&hb((function(){var t=mb([]);return Ab(new Sb,t,1),!gb(t)}))&&nb(wb,{set:function(t,e){var i;return ub(t)&&(gb(t)?i=_b:fb(t)&&(i=vb)),Ab(this,t,e),i==_b&&mb(t),i==vb&&yb(t),this}});var Tb=Kc,Eb=wc,Rb=Dd,Pb=Tb("Map"),Bb=Tb("WeakMap"),Ib=Eb([].push),Db=Rb("metadata"),Lb=Db.store||(Db.store=new Bb),Ob=function(t,e,i){var n=Lb.get(t);if(!n){if(!i)return;Lb.set(t,n=new Pb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Pb)}return s},Fb={store:Lb,getMap:Ob,has:function(t,e,i){var n=Ob(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Ob(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Ob(i,n,!0).set(t,e)},keys:function(t,e){var i=Ob(t,e,!1),n=[];return i&&i.forEach((function(t,e){Ib(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},zb=Pu,Hb=Fb.toKey,jb=Fb.set;qg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Hb(arguments[3]);jb(t,e,zb(i),n)}});var Nb=Pu,Vb=Fb.toKey,Wb=Fb.getMap,Ub=Fb.store;qg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Vb(arguments[2]),n=Wb(Nb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=Ub.get(e);return s.delete(i),!!s.size||Ub.delete(e)}});var Gb=Pu,Yb=s_,$b=Fb.has,Xb=Fb.get,Kb=Fb.toKey,qb=function(t,e,i){if($b(t,e,i))return Xb(t,e,i);var n=Yb(e);return null!==n?qb(t,n,i):void 0};qg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Kb(arguments[2]);return qb(t,Gb(e),i)}});var Zb=wc,Jb=Map.prototype,Qb={Map:Map,set:Zb(Jb.set),get:Zb(Jb.get),has:Zb(Jb.has),remove:Zb(Jb.delete),proto:Jb},tx=dc,ex=wc,ix=function(t,e,i){for(var n,s,r=i||t.next;!(n=tx(r,t)).done;)if(void 0!==(s=e(n.value)))return s},nx=Qb.Map,sx=Qb.proto,rx=ex(sx.forEach),ax=ex(sx.entries),ox=ax(new nx).next,lx=_d,hx=Ic,cx=lg,dx=Fd,ux=function(t,e,i){return i?ix(ax(t),(function(t){return e(t[1],t[0])}),ox):rx(t,e)},px=Qb.Map,gx=Qb.has,fx=Qb.set,mx=wc([].push),yx=qg,_x=wc,vx=Fb,bx=Pu,xx=s_,Sx=function(t){var e,i,n,s=dx(this),r=cx(s),a=[],o=new px,l=hx(t)?function(t){return t}:lx(t);for(e=0;e= than the number of constructor arguments of its base class."},bS=function(t,e){return"@postConstruct error in class "+t+": "+e},xS=function(t,e){return"@preDestroy error in class "+t+": "+e},SS=function(t,e){return"onDeactivation() error in class "+t+": "+e},wS="Maximum call stack size exceeded",AS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(tS,t),userGeneratedMetadata:Reflect.getMetadata(Jx,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(Qx,t)||[]},t}(),kS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function MS(t){return t instanceof RangeError||t.message===wS}function CS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function TS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=PS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function ES(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||ES(t.parentRequest,e))}function RS(t){t.childRequests.forEach((function(t){if(ES(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=CS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(yS+" "+e)}RS(t)}))}function PS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var BS=function(){function t(t){this.id=lS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),IS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Yx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),DS=function(t,e){this.parentContext=t,this.rootRequest=e},LS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),OS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),FS=function(){function t(t,e,i,n){this.id=lS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new OS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new IS(Yx,n):n instanceof IS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:WS(t,i)}return 0}function US(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[qx],multiInject:e[Zx],targetName:e[$x],unmanaged:e[Xx]}}var GS=function(){function t(t,e,i,n,s){this.id=lS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function YS(t){return t._bindingDictionary}function $S(t,e,i,n,s){var r=KS(i.container,s.serviceIdentifier),a=[];return r.length===kS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=KS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new GS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case kS.NoBindingsAvailable:if(i.isOptional())return e;var s=CS(t),r=gS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=TS(n,s,KS),new Error(r);case kS.OnlyOneBindingAvailable:return e;case kS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=CS(t),r=pS+" "+s;throw r+=TS(n,s,KS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function XS(t,e,i,n,s,r){var a,o;if(null===s){a=$S(t,e,n,null,r),o=new GS(i,n,null,a,r);var l=new DS(n,o);n.addPlan(l)}else a=$S(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===rS.Instance&&null!==e.implementationType){var s=function(t,e){return HS(t,PS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=WS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===aS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=JS(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=rw(rw({},s),{constr:t});n=s.isAsync?function(t){return aw(this,void 0,void 0,(function(){var e,i;return ow(this,(function(n){switch(n.label){case 0:return[4,dw(t.constructorInjections)];case 1:return e=n.sent(),[4,dw(t.propertyInjections)];case 2:return i=n.sent(),[2,cw(rw(rw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):cw(r)}else n=new t;return n}function cw(t){var e,i=new((e=t.constr).bind.apply(e,lw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function dw(t){return aw(this,void 0,void 0,(function(){var e,i,n,s;return ow(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Hw=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new zw,onDeactivations:new zw}},t}(),jw=function(){return jw=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new rA(e,i)})).inSingletonScope().whenTargetNamed(e)}class oA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class lA extends oA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const hA=Symbol.for("EnvContribution"),cA=Symbol.for("Global");var dA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,n){e(i,n,t)}};let gA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new lA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};gA=dA([qw(),pA(0,Qw(sA)),pA(0,Zw(hA)),uA("design:paramtypes",[Object])],gA);const fA=cs-1e-8;class mA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>fA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=cs)<0&&(n+=cs),(s%=cs)<0&&(s+=cs),ss;++o,a-=hs)g(a);else for(a=n-n%hs+hs,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const _A=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,vA={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},bA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let xA,SA,wA,AA,kA,MA;var CA,TA,EA,RA,PA,BA,IA,DA,LA;function OA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function FA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Es(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=cs:T>0&&0===r&&(T-=cs);const E=Math.ceil(Math.abs(T/(hs+.001))),R=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function jA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class qA extends KA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function ZA(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class JA{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function QA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new KA("linear",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new JA(s,n),t),s}function tk(t,e,i,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n)}class ek{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&tk(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:tk(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ik(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return QA(t,e);const s=new KA("basis",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new ek(s,n),t),s}function nk(t){return t<0?-1:1}function sk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(nk(r)+nk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function rk(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function ak(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class ok{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined2);break;case 3:ak(this,this._t0,rk(this,this._t0),!1!==this._lastDefined2)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,ak(this,rk(this,e=sk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:ak(this,this._t0,e=sk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined}}tryUpdateLength(){return this.context.tryUpdateLength()}}class lk extends ok{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function hk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return QA(t,e);const s=new KA("monotoneX",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new ok(s,n),t),s}function ck(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return QA(t,e);const s=new qA("monotoneY",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new lk(s,n),t),s}let dk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function uk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new KA("step",null!=n?n:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new dk(r,e,s),t),r}class pk{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){this.context.closePath()}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function gk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new KA("linear",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new pk(s,n),t),s}function fk(t,e,i){switch(e){case"linear":default:return QA(t,i);case"basis":return ik(t,i);case"monotoneX":return hk(t,i);case"monotoneY":return ck(t,i);case"step":return uk(t,.5,i);case"stepBefore":return uk(t,0,i);case"stepAfter":return uk(t,1,i);case"linearClosed":return gk(t,i)}}class mk extends yA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new mA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([bA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([bA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([bA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([bA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([bA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([bA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([bA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([bA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([bA.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const t=[];t[bA.M]=t=>`M${t[1]} ${t[2]}`,t[bA.L]=t=>`L${t[1]} ${t[2]}`,t[bA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[bA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[bA.A]=t=>{const e=[];zA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tMA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),jA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===IA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return us(t.p0.y-e.p1.y)}if(this.direction===IA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return us(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const yk=["l",0,0,0,0,0,0,0];function _k(t,e,i){const n=yk[0]=t[0];if("a"===n||"A"===n)yk[1]=e*t[1],yk[2]=i*t[2],yk[3]=t[3],yk[4]=t[4],yk[5]=t[5],yk[6]=e*t[6],yk[7]=i*t[7];else if("h"===n||"H"===n)yk[1]=e*t[1];else if("v"===n||"V"===n)yk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Ik=Object.assign(Object.assign({},kk),{points:[],cornerRadius:0}),Dk=Object.assign(Object.assign({},kk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Lk=Object.assign(Object.assign({},kk),{width:0,height:0,cornerRadius:0,length:0}),Ok=Object.assign(Object.assign({},kk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Fk=Object.assign(Object.assign(Object.assign({},kk),wk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),zk=Object.assign(Object.assign({},kk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Hk=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},kk),{fill:!0}),jk=Object.assign(Object.assign({},Hk),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});var Nk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Fk.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};Vk=Nk([qw()],Vk);var Wk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Uk=Symbol.for("TextMeasureContribution");let Gk=class extends Vk{};Gk=Wk([qw()],Gk);const Yk=new Uw;const $k=new class{},Xk=Symbol.for("CanvasFactory"),Kk=Symbol.for("Context2dFactory");function qk(t){return Yk.getNamed(Xk,$k.global.env)(t)}const Zk=1e-4,Jk=Math.sqrt(3),Qk=1/3;function tM(t){return t>-gM&&tgM||t<-gM}const iM=[0,0],nM=[0,0],sM=[0,0];function rM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function aM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function oM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function lM(t){return(t%=ds)<0&&(t+=ds),t}function hM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function cM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=ds);let d=Math.atan2(l,o);return d<0&&(d+=ds),d>=n&&d<=s||d+ds>=n&&d+ds<=s}function pM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(tM(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const mM=[-1,-1,-1],yM=[-1,-1];function _M(){const t=yM[0];yM[0]=yM[1],yM[1]=t}function vM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(tM(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Qk):Math.pow(i,Qk),n=n<0?-Math.pow(-n,Qk):Math.pow(n,Qk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Jk*Math.sin(e)))/(3*a),h=(-o+i*(n-Jk*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,mM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&_M(),p=oM(e,n,r,o,yM[0]),u>1&&(g=oM(e,n,r,o,yM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(tM(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,mM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=aM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);mM[0]=-l,mM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=ds-1e-4){n=0,s=ds;const e=r?1:-1;return a>=mM[0]+t&&a<=mM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=ds,s+=ds);let c=0;for(let e=0;e<2;e++){const i=mM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=ds+t),(t>=n&&t<=s||t+ds>=n&&t+ds<=s)&&(t>ls/2&&t<1.5*ls&&(e=-e),c+=e)}}return c}function SM(t){return Math.round(t/ls*1e8)/1e8%2*ls}function wM(t,e){let i=SM(t[0]);i<0&&(i+=ds);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=ds?s=i+ds:e&&i-s>=ds?s=i-ds:!e&&i>s?s=i+(ds-SM(i-s)):e&&i1&&(i||(h+=hM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;AM[0]=S,AM[1]=w,wM(AM,Boolean(a[6])),S=AM[0],w=AM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case bA.M:u=m,p=y,c=u,d=p;break;case bA.L:if(i){if(pM(c,d,m,y,e,n,s))return!0}else h+=hM(c,d,m,y,n,s)||0;c=m,d=y;break;case bA.C:if(i){if(dM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=vM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case bA.Q:if(i){if(cM(c,d,m,y,_,v,e,n,s))return!0}else h+=bM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case bA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=hM(c,d,o,l,n,s),i){if(uM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=xM(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case bA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(pM(u,p,o,p,e,n,s)||pM(o,p,o,l,e,n,s)||pM(o,l,u,l,e,n,s)||pM(u,l,u,p,e,n,s))return!0}else h+=hM(o,p,o,l,n,s),h+=hM(u,l,u,p,n,s);break;case bA.Z:if(i){if(pM(c,d,u,p,e,n,s))return!0}else h+=hM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TM=function(t,e){return function(i,n){e(i,n,t)}};let EM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=qk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:wk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new wr(Object.assign({defaultFontParams:{fontFamily:wk.fontFamily,fontSize:wk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+wr.ALPHABET_CHAR_SET+wr.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var RM;EM=MM([qw(),TM(0,Qw(sA)),TM(0,Zw(Uk)),TM(1,Qw(cA)),CM("design:paramtypes",[Object,Object])],EM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(RM||(RM={}));const PM=new Ls;let BM=class{constructor(){this.matrix=new Ls}init(t){return this.mode=RM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=RM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(PM.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(PM.a,PM.b,PM.c,PM.d,PM.e,PM.f),this}scale(t,e,i){return this.mode===RM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return PM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(PM.a,PM.b,PM.c,PM.d,PM.e,PM.f),this}translate(t,e){return this.mode===RM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===RM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};BM=MM([qw(),CM("design:paramtypes",[])],BM);const IM={arc:Mk,area:Ck,circle:Tk,line:Pk,path:Bk,symbol:Ok,text:Fk,rect:Dk,rect3d:Lk,polygon:Ik,richtext:zk,richtextIcon:jk,image:Hk,group:Ek,glyph:Rk},DM=Object.keys(IM);function LM(){return{arc:Object.assign({},IM.arc),area:Object.assign({},IM.area),circle:Object.assign({},IM.circle),line:Object.assign({},IM.line),path:Object.assign({},IM.path),symbol:Object.assign({},IM.symbol),text:Object.assign({},IM.text),rect:Object.assign({},IM.rect),rect3d:Object.assign({},IM.rect3d),polygon:Object.assign({},IM.polygon),richtext:Object.assign({},IM.richtext),richtextIcon:Object.assign({},IM.richtextIcon),image:Object.assign({},IM.image),group:Object.assign({},IM.group),glyph:Object.assign({},IM.glyph)}}function OM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const FM=new Array(60).fill(0).map((()=>LM()));class zM{constructor(){this._defaultTheme=FM.pop()||LM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?OM(this.userTheme,t.userTheme,!1):this.userTheme=mn(t.userTheme),OM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);DM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const HM=new zM;function jM(t,e){return t.glyphHost?jM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):HM.getTheme()}return null}(t)||HM.getTheme()}class NM{static GenAutoIncrementId(){return NM.auto_increment_id++}}NM.auto_increment_id=0;var VM=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class WM extends Ui{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=NM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return VM(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(qM(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=qM(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=qM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=qM(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=KM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(qM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(qM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,qM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):qM(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof $M))return void console.warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i=0&&t<=pn(this.rootTarget,"width")&&e>=0&&e<=pn(this.rootTarget,"height")?this.rootTarget:null,i}}const JM={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof UM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new XM(t,e))}},QM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class tC{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new ZM(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new YM,this.rootWheelEvent=new $M,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&tn(t)&&!fn(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class eC{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const iC=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},nC=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class sC extends Ui{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=KM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=KM.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||iC(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=nC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=KM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=nC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=iC(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=KM.now()-i>this.config.press.time&&nC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class aC{static Avaliable(){return!0}avaliable(){return aC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class oC{static Avaliable(){return!!$k.global.getRequestAnimationFrame()}avaliable(){return oC.Avaliable()}tick(t,e){$k.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var lC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(lC||(lC={}));class hC{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-hC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*hC.bounceIn(2*t):.5*hC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/ds*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*ds/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/ds*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*ds/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/ds*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*ds/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*ds/e)*.5+1}}}hC.quadIn=hC.getPowIn(2),hC.quadOut=hC.getPowOut(2),hC.quadInOut=hC.getPowInOut(2),hC.cubicIn=hC.getPowIn(3),hC.cubicOut=hC.getPowOut(3),hC.cubicInOut=hC.getPowInOut(3),hC.quartIn=hC.getPowIn(4),hC.quartOut=hC.getPowOut(4),hC.quartInOut=hC.getPowInOut(4),hC.quintIn=hC.getPowIn(5),hC.quintOut=hC.getPowOut(5),hC.quintInOut=hC.getPowInOut(5),hC.backIn=hC.getBackIn(1.7),hC.backOut=hC.getBackOut(1.7),hC.backInOut=hC.getBackInOut(1.7),hC.elasticIn=hC.getElasticIn(1,.3),hC.elasticOut=hC.getElasticOut(1,.3),hC.elasticInOut=hC.getElasticInOut(1,.3*1.5);const cC=new class{constructor(){this.id=NM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===RA.END?this.removeAnimate(e):e.status===RA.RUNNING||e.status===RA.INITIAL?(this.animateCount++,e.advance(t)):e.status===RA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class dC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class uC extends dC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let pC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cC;this.id=t,this.timeline=e,this.status=RA.INITIAL,this.tailAnimate=new gC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=fs(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&PA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:EA.ANIMATE_PLAY})}runCb(t){const e=new uC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===RA.RUNNING&&(this.status=RA.PAUSED)}resume(){this.status===RA.PAUSED&&(this.status=RA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new gC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===RA.RUNNING&&(this.status=RA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=RA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};pC.mode=PA.NORMAL,pC.interpolateMap=new Map;class gC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new fC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?hC[i]:i,s=this._addStep(e,null,n);return s.type=BA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?hC[i]:i,r=this._addStep(e,null,s);return r.type=BA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=BA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=BA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new fC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class fC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const mC=200,yC="cubicOut",_C=1e3,vC="quadInOut";var bC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(bC||(bC={}));const xC=[!1,!1,!1,!1],SC=[0,0,0,0],wC=t=>t?en(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(SC[0]=t[0],SC[2]=t[0],SC[1]=t[1],SC[3]=t[1],SC):t:t:0,AC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],kC=[1,2,3,0,1,2,3,0];function MC(t,e,i,n){for(;t>=ds;)t-=ds;for(;t<0;)t+=ds;for(;t>e;)e+=ds;AC[0].x=i,AC[1].y=i,AC[2].x=-i,AC[3].y=-i;const s=Math.ceil(t/hs)%4,r=Math.ceil(e/hs)%4;if(n.add(gs(t)*i,ys(t)*i),n.add(gs(e)*i,ys(e)*i),s!==r||e-t>ls){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new As(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new As(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new As(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=CC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class DC extends dC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:EA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:EA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:EA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class LC extends DC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=$k.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class OC extends DC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=$k.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class FC extends dC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=ds-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+ls/2;i.alpha>ds;)i.alpha-=ds;i.alpha=ds-i.alpha,i.zIndex=-1e4*i.z}}class zC extends dC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class HC extends dC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?hC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function jC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function NC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{Un(e,n)&&Un(i,s)||t.push(e,i,n,s,n,s)};function $C(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function XC(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&rn(t.x)&&rn(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),QC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},tT=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Cs;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return QC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return QC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);tT(s[0],n,i),tT(s[1],e-n,i)}};var eT={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const iT={};for(const t in eT)fn(eT,t)&&(iT[eT[t]]=t);const nT={to:{},get:{}};function sT(t,e,i){return Math.min(Math.max(e,t),i)}function rT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}nT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=nT.get.hsl(t,n),i="hsl";break;case"hwb":e=nT.get.hwb(t,n),i="hwb";break;default:e=nT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},nT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=eT[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=sT(e[n],0,255);return e[3]=sT(e[3],0,1),e},nT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=sT(parseFloat(i[2]),0,100),e[2]=sT(parseFloat(i[3]),0,100),e[3]=sT(isNaN(t)?1:t,0,1),e}return null},nT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=sT(parseFloat(i[2]),0,100),e[2]=sT(parseFloat(i[3]),0,100),e[3]=sT(isNaN(t)?1:t,0,1),e}return null},nT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},nT.to.keyword=function(t){return iT[t.slice(0,3)]};const aT=nT;var oT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(oT||(oT={}));class lT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===oT.Color1){let e=lT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=nT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];lT.store1[t]=s,lT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=lT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=nT.get(t),n&&n.value){const e=n.value;lT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],lT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===oT.Color1){if(lT.store1[t])return;lT.store1[t]=i,lT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(lT.store255[t])return;lT.store255[t]=i,lT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function hT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function cT(t,e,i,n,s){if(!t||!e)return t&&hT(t)||e&&hT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=lT.Get(t,oT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=lT.Get(e,oT.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:hT(a)})))});return o?cT(r,l,i,n,s):cT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:pT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:pT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:pT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),hT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}lT.store255={},lT.store1={};const dT=[0,0,0,0],uT=[0,0,0,0];function pT(t,e,i){return lT.Get(t,oT.Color255,dT),lT.Get(e,oT.Color255,uT),`rgba(${Math.round(dT[0]+(uT[0]-dT[0])*i)},${Math.round(dT[1]+(uT[1]-dT[1])*i)},${Math.round(dT[2]+(uT[2]-dT[2])*i)},${dT[3]+(uT[3]-dT[3])*i})`}const gT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=cT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},fT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?$C(t):[],s=$C(e);i&&n&&(i.fromTransform&&XC(n,i.fromTransform.clone().getInverse()),XC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},yT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],_T=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!yT.includes(s))return;const r=e[s];Xi(r)||Xi(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?lT.Get(t[s],oT.Color255):t[s],to:"string"==typeof r?lT.Get(r,oT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class vT extends dC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;fT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&gT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const bT=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=mT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=_T(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new vT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:_C,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:vC)),c};class xT extends dC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;fT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&gT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ST=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>EC.includes(t))(i)||(e[i]=t[i])})),e},wT=(t,e,i)=>{const n=ST(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=$k.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},AT=(t,e,i)=>{const n=[],s=i?null:ST(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:ST(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=qC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push($k.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=qC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push($k.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=qC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push($k.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return ZC(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ZC(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push($k.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:JC(i)}];const n=[];return tT(i,e,n),n})(t,e).forEach((t=>{n.push($k.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&rn(t.x)&&rn(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return tT(r,e,h),h})(t,e).forEach((t=>{n.push($k.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=$C(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push($k.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push($k.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&wT(t,n,e),n};class MT{static GetImage(t,e){var i;let n=MT.cache.get(t);n?"fail"===n.loadState?$k.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&$k.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},MT.cache.set(t,n),n.dataPromise=$k.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=MT.cache.get(t);n?"fail"===n.loadState?$k.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&$k.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},MT.cache.set(t,n),n.dataPromise=$k.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=MT.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},MT.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=$k.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=$k.global.loadBlob(t):"json"===e&&(i.dataPromise=$k.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}MT.cache=new Map;const CT=new Ls,TT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],ET=["x","y"],RT=["scaleX","scaleY"],PT=["angle"],BT=new As;class IT extends WM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Ts,this._updateTag=CA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=jM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;BT.x=i+e,BT.y=n+s}else BT.x=i,BT.y=n;return BT}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;$k.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return $k.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Ls),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&CA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&CA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&CA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&CA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&CA.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&CA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=CA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===TA.GLOBAL){const i=new As(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){$k.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!Xi(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:mC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:yC)}else this.setAttributes(t,!1,{type:EA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();fn(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=CA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=CA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=CA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&CA.UPDATE_SHAPE_AND_BOUNDS)===CA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=CA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=CA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=CA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=CA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=CA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=vk.x,y:e=vk.y,scaleX:i=vk.scaleX,scaleY:n=vk.scaleY,angle:s=vk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=gs(a),f=ys(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(vk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=CT.setValue(a.a,a.b,a.c,a.d,a.e,a.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),$k.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:EA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:EA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=cT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=cT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=cT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return jM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:$k.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return tn(t,!0)?this.pathProxy=(new mk).fromString(t):this.pathProxy=new mk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",on(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(MT.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new XM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}IT.mixin(JM);var DT=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function LT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let OT=0;function FT(){return OT++}const zT=FT(),HT=FT(),jT=FT(),NT=FT(),VT=FT(),WT=FT(),UT=FT(),GT=FT(),YT=FT(),$T=FT(),XT=FT(),KT=FT(),qT=FT(),ZT=FT(),JT=FT(),QT=FT(),tE=Symbol.for("GraphicService"),eE=Symbol.for("GraphicCreator");var iE;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(iE||(iE={}));let nE=class t extends IT{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=WT,this._childUpdateTag=CA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new zM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new zM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===TA.GLOBAL){const i=new As(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&CA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;$k.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return $k.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=jM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=$k.graphicService.updateGroupAABBBounds(t,jM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=wC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=CA.CLEAR_BOUNDS,this._childUpdateTag&=CA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=CA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&CA.UPDATE_BOUNDS||(this._childUpdateTag|=CA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),$k.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),$k.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,$k.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{$k.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),$k.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&CA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=$k.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const sE=Symbol.for("LayerHandlerContribution");class rE extends nE{get offscreen(){return this.layerHandler.offscreen}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=Yk.get(sE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new zM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{$k.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{$k.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var aE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lE=function(t,e){return function(i,n){e(i,n,t)}};let hE=class{constructor(t){this.global=t,this.layerMap=new Map,this.staticLayerCountInEnv=t.getStaticCanvasCount(),this.dynamicLayerCountInEnv=t.getDynamicCanvasCount()}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};const i=new rE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}};hE=aE([qw(),lE(0,Qw(cA)),oE("design:paramtypes",[Object])],hE);var cE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uE=function(t,e){return function(i,n){e(i,n,t)}};const pE=Symbol.for("Window"),gE=Symbol.for("WindowHandlerContribution");let fE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new lA(["x","y","width","height"])},this._uid=NM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Yk.getNamed(gE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};cE([nA(),dE("design:type",Function),dE("design:paramtypes",[]),dE("design:returntype",void 0)],fE.prototype,"postInit",null),fE=cE([qw(),uE(0,Qw(cA)),dE("design:paramtypes",[Object])],fE);const mE=Symbol.for("TransformUtil"),yE=Symbol.for("GraphicUtil"),_E=Symbol.for("LayerService");var vE=new Gw((t=>{t(gA).toSelf().inSingletonScope(),t(cA).toService(gA),t(fE).to(fE),t(pE).toService(fE),t(EM).toSelf().inSingletonScope(),t(yE).toService(EM),t(BM).toSelf().inSingletonScope(),t(mE).toService(BM),t(hE).toSelf().inSingletonScope(),t(_E).toService(hE)}));function bE(t){return!!t}function xE(t,e){let i;return i=en(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function SE(t,e){return t*e>0}function wE(t,e,i,n){return t*e>0&&i>0&&n>0}function AE(t,e){return t*e>0}function kE(t,e,i,n){return t*e>0&&i>0&&n>0}function ME(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=jM(t,null==r?void 0:r.theme)[t.type],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible}=t.attribute,m=SE(d,u),y=AE(d,g),_=bE(h),v=xE(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return jA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function CE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uR*R+P*P&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function EE(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=us(l-o),c=l>o;let d=!1;if(s=ds-os)e.moveTo(i+s*gs(o),n+s*ys(o)),e.arc(i,n,s,o,l,!c),r>os&&(e.moveTo(i+r*gs(l),n+r*ys(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*gs(f),T=s*ys(f),E=r*gs(y),R=r*ys(y);let P,B,I,D;if((A>os||w>os)&&(P=s*gs(m),B=s*ys(m),I=r*gs(_),D=r*ys(_),hos){const t=ms(v,k),r=ms(b,k),o=TE(I,D,C,T,s,t,Number(c)),l=TE(P,B,E,R,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,ps(o.y01,o.x01),ps(o.y11,o.x11),!c),e.arc(i,n,s,ps(o.cy+o.y11,o.cx+o.x11),ps(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,ps(l.y11,l.x11),ps(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*gs(ps(l.y01,l.x01)),n+l.cy+r*ys(ps(l.y01,l.x01))):e.moveTo(i+P,n+s*ys(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>os)||g<.001)!a||a[1]?e.lineTo(i+E,n+R):e.moveTo(i+E,n+R),d=!0;else if(M>os){const t=ms(S,M),s=ms(x,M),o=TE(E,R,P,B,r,-s,Number(c)),l=TE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,ps(o.y01,o.x01),ps(o.y11,o.x11),!c),e.arc(i,n,r,ps(o.cy+o.y11,o.cx+o.x11),ps(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,ps(l.y11,l.x11),ps(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*gs(ps(l.y01,l.x01)),n+l.cy+t*ys(ps(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+R):e.moveTo(i+E,n+R),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*gs(_),n+r*ys(_))}return a?a[3]&&e.lineTo(i+s*gs(l),n+s*gs(l)):e.closePath(),d}class RE{static GetCanvas(){try{return RE.canvas||(RE.canvas=$k.global.createCanvas({})),RE.canvas}catch(t){return null}}static GetCtx(){if(!RE.ctx){const t=RE.GetCanvas();RE.ctx=t.getContext("2d")}return RE.ctx}}class PE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=RE.GetCanvas(),n=RE.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=PE.dataMap.get(i);return n||(n=new PE(t,e),PE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){PE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return PE.dataMap.get(t)}}PE.dataMap=new Map;class BE{static GetSize(t){for(let e=0;e=t)return BE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=BE.GenKey(t,e,i,n,s),l=BE.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=BE.GenKey(t,e,i,n,s);BE.cache[l]?BE.cache[l].push({width:a,height:o,pattern:r}):BE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}BE.cache={},BE.ImageSize=[20,40,80,160,320,640,1280,2560];const IE=Symbol.for("ArcRenderContribution"),DE=Symbol.for("AreaRenderContribution"),LE=Symbol.for("CircleRenderContribution"),OE=Symbol.for("GroupRenderContribution"),FE=Symbol.for("ImageRenderContribution"),zE=Symbol.for("PathRenderContribution"),HE=Symbol.for("PolygonRenderContribution"),jE=Symbol.for("RectRenderContribution"),NE=Symbol.for("SymbolRenderContribution"),VE=Symbol.for("TextRenderContribution"),WE=Symbol.for("InteractiveSubRenderContribution");var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},YE=function(t,e){return function(i,n){e(i,n,t)}};let $E=class{constructor(t){this.arcRenderContribitions=t,this.numberType=zT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=us(d-c),p=d>c;let g=!1;if(sos||M>os)&&(D=s*gs(v),L=s*ys(v),O=r*gs(x),F=r*ys(x),uos){const t=ms(S,T),r=ms(w,T),a=TE(O,F,R,P,s,t,Number(p)),o=TE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,ps(o.y11,o.x11),ps(o.y01,o.x01),!p)}}else e.moveTo(i+R,n+P);if(!(r>os)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>os){const t=ms(k,E),s=ms(A,E),a=TE(B,I,D,L,r,-s,Number(p)),o=TE(R,P,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,ps(a.y01,a.x01),ps(a.y11,a.x11),!p);const t=ps(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*gs(x),n+r*ys(x));return g}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,fillOpacity:p=l.fillOpacity,lineWidth:g=l.lineWidth,strokeOpacity:f=l.strokeOpacity,visible:m=l.visible,x:y=l.x,y:_=l.y}=t.attribute,v=SE(u,p),b=AE(u,f),x=bE(h),S=xE(d,g);if(!t.valid||!m)return;if(!(x||S||c))return;if(!(v||b||a||o||c))return;const{outerRadius:w=l.outerRadius,innerRadius:A=l.innerRadius,cap:k=l.cap,forceShowCap:M=l.forceShowCap}=t.attribute;let C=!1;const{isFullStroke:T,stroke:E}=(t=>{var e;let i=!0;if(Yi(t,!0)){for(let n=0;n<4;n++)xC[n]=t,i&&(i=!(null!==(e=xC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)xC[e]=!!t[e],i&&(i=!!xC[e]);else xC[0]=!1,xC[1]=!1,xC[2]=!1,xC[3]=!1;return{isFullStroke:i,stroke:xC}})(d);if(x||T||c){if(e.beginPath(),EE(t,e,i,n,w,A),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===LA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}C=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),x&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,y-i,_-n,l),e.fill())),S&&T&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,y-i,_-n,l),e.stroke()))}if(!T&&S){if(e.beginPath(),EE(t,e,i,n,w,A,E),!C){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===LA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}C=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)}))}o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())}if(k&&M){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(us(h-r)>=ds-os){e.beginPath();const r=Math.abs(w-A)/2/w,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,n,w,A,d,d+r),!C){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===LA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}C=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)}))}if(x){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=ds;for(;i>ds;)i-=ds;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),cT(o.color,l.color,h,!1)}(0,0,h,s);a||SE&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=r,e.fill())}}S&&(o||b&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=jM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};$E=UE([qw(),YE(0,Qw(sA)),YE(0,Zw(IE)),GE("design:paramtypes",[Object])],$E);var XE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qE=function(t,e){return function(i,n){e(i,n,t)}};let ZE=class{constructor(t){this.circleRenderContribitions=t,this.numberType=NT}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=SE(y,f),w=AE(y,m),A=bE(h),k=xE(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};ZE=XE([qw(),qE(0,Qw(sA)),qE(0,Zw(LE)),KE("design:paramtypes",[Object])],ZE);const JE=["radius","startAngle","endAngle",...TT];class QE extends IT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=NT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=jM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=$k.graphicService.updateCircleAABBBounds(i,jM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=wC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function eR(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function iR(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class nR{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=QT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=jM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=jM(this).text,n=$k.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=eR(c,s),e=iR(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=eR(c,s),_=iR(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=jM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const g=$k.graphicUtil.textMeasure,f=new nR(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).text[t]}needUpdateTags(t){for(let e=0;e{YR[t.type]=t}));const $R=["symbolType","size",...TT];let XR=class t extends IT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=JT}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return en(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=jM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=YR[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new mk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/fs(r,a);return s.transform(0,0,o,o),this._parsedPath=new GR(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=jM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=$k.graphicService.updateSymbolAABBBounds(i,jM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=wC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).symbol[t]}needUpdateTags(t){for(let e=0;e<$R.length;e++){const i=$R[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$R.length;e++)if(t===$R[e])return!0;return!1}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=en(e)?e:[e,e];return t.path?(new mk).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new mk).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}};XR.userSymbolMap={};const KR=["segments","points","curveType",...TT];let qR=class t extends IT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=TC(i,n,e))}doUpdateAABBBounds(){const t=jM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateLineAABBBounds(e,jM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const ZR=["width","height","cornerRadius",...TT];class JR extends IT{constructor(t){super(t),this.type="rect",this.numberType=KT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=jM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateRectAABBBounds(e,jM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).rect[t]}needUpdateTags(t){for(let e=0;e{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=$k.graphicService.updateGlyphAABBBounds(this.attribute,jM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new eP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const iP={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},nP=!0,sP=!1,rP=/\w|\(|\)/,aP=/[.?!,;:/,。?!、;:]/,oP=/\S/;function lP(t,e,i,n,s){if(!e||e<=0)return 0;const r=$k.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=function(t,e){let i=e;for(;rP.test(t[i-1])&&rP.test(t[i])||aP.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function hP(t,e){const i=$k.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class cP{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=iP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class dP{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=hP(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=hP(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=lP(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=hP(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||sP;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||nP;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=lP(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=hP(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const uP=["width","height","image",...TT];class pP extends IT{constructor(t){super(t),this.type="image",this.numberType=UT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=jM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateImageAABBBounds(e,jM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Hk[t]}needUpdateTags(t){for(let e=0;e{if(en(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=wC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Hk.width,height:e=Hk.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class fP{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof gP?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=iP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof dP){const e=oP.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof gP)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=hP("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof gP)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof gP)break;const{width:n}=hP("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof gP?t.width:t.getWidthWithEllips(this.direction)})),e}}class mP{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=iP[this.direction]}store(t){if(t instanceof gP){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new fP(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof gP?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=lP(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new dP(i,t.newLine,t.character),new dP(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const yP=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...TT];class _P extends IT{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ZT}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:zk.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:zk.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:zk.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:zk.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:zk.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:zk.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:zk.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:zk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=jM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateRichTextAABBBounds(e,jM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return zk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new mP(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const vP=["path","customPath",...TT];class bP extends IT{constructor(t){super(t),this.type="path",this.numberType=YT}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=jM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof mk?e.path:(Xi(this.cache)&&this.doUpdatePathShape(),this.cache instanceof mk?this.cache:t.path)}doUpdateAABBBounds(){const t=jM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updatePathAABBBounds(e,jM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;tn(t.path,!0)?this.cache=(new mk).fromString(t.path):t.customPath&&(this.cache=new mk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new SP(Object.assign({},this.attribute))}}const wP=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...TT];class AP extends IT{constructor(t){super(t),this.type="arc",this.numberType=zT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=jM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(rn(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=jM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Bs(e),i=e+r,n&&us(r)os&&o>os)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=jM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=_s(n*n+s*s)}=this.attribute,o=us(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>os&&a>os){const i=e>t?1:-1;let r=xs(Number(a)/s*ys(u)),o=xs(Number(a)/n*ys(u));return(p-=2*r)>os?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>os?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=jM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=$k.graphicService.updateArcAABBBounds(i,jM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=wC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=ds-os)o.moveTo(0+s*gs(e),0+s*ys(e)),o.arc(0,0,s,e,i,!a),n>os&&(o.moveTo(0+n*gs(i),0+n*ys(i)),o.arc(0,0,n,i,e,a));else{const t=s*gs(e),r=s*ys(e),l=n*gs(i),h=n*ys(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new AP(Object.assign({},this.attribute))}}class kP extends AP{constructor(t){super(t),this.type="arc3d",this.numberType=HT}doUpdateAABBBounds(){const t=jM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateArc3dAABBBounds(e,jM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const MP=["points","cornerRadius",...TT];class CP extends IT{constructor(t){super(t),this.type="polygon",this.numberType=$T}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=jM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updatePolygonAABBBounds(e,jM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=TC(i,n,e))}getDefaultAttribute(t){return jM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new CP(Object.assign({},this.attribute))}}class TP extends CP{constructor(t){super(t),this.type="pyramid3d",this.numberType=XT}doUpdateAABBBounds(){const t=jM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updatePyramid3dAABBBounds(e,jM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var EP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RP=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};RP=EP([qw()],RP);var PP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const BP=Symbol.for("RectBoundsContribution");let IP=class extends RP{};IP=PP([qw()],IP);var DP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const LP=Symbol.for("SymbolBoundsContribution");let OP=class extends RP{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;LT(i,n+r+o/2,!0,a)}return i}};OP=DP([qw()],OP);var FP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const zP=Symbol.for("CircleBoundsContribution");let HP=class extends RP{};HP=FP([qw()],HP);var jP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const NP=Symbol.for("ArcBoundsContribution");let VP=class extends RP{};VP=jP([qw()],VP);var WP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const UP=Symbol.for("PathBoundsContribution");let GP=class extends RP{};GP=WP([qw()],GP);class YP{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return YP.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZP=function(t,e){return function(i,n){e(i,n,t)}};function JP(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function QP(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function tB(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function eB(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),JP(t,t,[s+o,r+l,a+h]),JP(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),JP(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=XP.allocate(),n=[0,0];if(y){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}JP(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),JP(i,i,[-n[0],-n[1],0]),tB(t,t,i)}}let iB=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new lA(["graphic"]),onSetStage:new lA(["graphic","stage"]),onRemove:new lA(["graphic"]),onAddIncremental:new lA(["graphic","group","stage"]),onClearIncremental:new lA(["graphic","group","stage"]),beforeUpdateAABBBounds:new lA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new lA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Ts,this.tempAABBBounds2=new Ts}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new mA(t);return jA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),Ms(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>ds-os?i.set(-a,-a,a,a):MC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=os?i.set(0,0,0,0):Math.abs(a-o)>ds-os?i.set(-s,-s,s,s):(MC(o,a,s,i),MC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(en(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){LT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){LT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Ms(e,e,s.transMatrix)}};iB=KP([qw(),ZP(0,Qw(eE)),ZP(1,Qw(sA)),ZP(1,Zw(BP)),ZP(2,Qw(sA)),ZP(2,Zw(LP)),ZP(3,Qw(sA)),ZP(3,Zw(zP)),ZP(4,Qw(sA)),ZP(4,Zw(NP)),ZP(5,Qw(sA)),ZP(5,Zw(UP)),qP("design:paramtypes",[Object,Object,Object,Object,Object,Object])],iB);class nB extends nE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const sB=["heightLimit","lineClamp"];class rB extends rR{_isValid(){const{text:t}=this.attribute;return en(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=jM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=$k.graphicUtil.textMeasure,f=new nR(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=XP.allocate(),s=XP.allocate();eB(s,t,e),tB(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),XP.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,y,_,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function AB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),kB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=IA.ROW:"y"===n?c=IA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CB=class extends wB{constructor(){super(...arguments),this.numberType=GT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const m=null!==(f=this.z)&&void 0!==f?f:0;AB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:m}),u.cache&&!en(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,y-c,_-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,y-c,_-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=SE(d,u),y=AE(d,p),_=bE(h),v=xE(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined),s=fk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=fk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],ms(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function TB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),EB(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),EB(t,l,1,n),o=!1):o=!0}t.closePath()}function EB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=GA(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}CB=MB([qw()],CB);var RB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BB=function(t,e){return function(i,n){e(i,n,t)}};function IB(t,e,i){switch(e){case"linear":default:return QA(t,i);case"basis":return ik(t,i);case"monotoneX":return hk(t,i);case"monotoneY":return ck(t,i);case"step":return uk(t,.5,i);case"stepBefore":return uk(t,0,i);case"stepAfter":return uk(t,1,i);case"linearClosed":return gk(t,i)}}let DB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=jM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=SE(y,m),A=bE(f),k=xE(b,x),M=AE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=IB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=IB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const r=IB(i,n),a=IB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],ms(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=jM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?IA.ROW:IA.COLUMN,Number.isFinite(c)||(o=IA.COLUMN),Number.isFinite(d)||(o=IA.ROW);const u=i*(o===IA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===LA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:m=0,x:y=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,m-h,y-c,o),t.fill())),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;en(i)&&i[0]&&!1===i[1]&&(t.beginPath(),AB(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,m-h,y-c,o),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===LA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1}};DB=RB([qw(),BB(0,Qw(sA)),BB(0,Zw(DE)),PB("design:paramtypes",[Object])],DB);var LB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FB=function(t,e){return function(i,n){e(i,n,t)}};let zB=class extends wB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=jM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=SE(f,p),w=AE(f,g),A=bE(d),k=xE(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)jA(t.pathShape.commandList,e,i,n,1,1,x);else{jA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};zB=LB([qw(),FB(0,Qw(sA)),FB(0,Zw(zE)),OB("design:paramtypes",[Object])],zB);const HB=ls/2;function jB(t,e,i,n,s,r){let a;if(rn(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],v=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!Rn(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-HB,0,!1)}if(t.lineTo(_[0],_[1]),!Rn(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,HB,!1)}if(t.lineTo(v[0],v[1]),!Rn(v,b)){const e=v[0],i=v[1]-u[3];t.arc(e,i,u[3],HB,ls,!1)}if(t.lineTo(g[0],g[1]),!Rn(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],ls,ls+HB,!1)}return t.closePath(),t}var NB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:_=l.strokeOpacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=wE(f,m,u,p),w=kE(f,_,u,p),A=bE(h),k=xE(d,y);if(!t.valid||!v)return;if(!(A||k||c))return;if(!(S||w||a||o||c))return;0===g||en(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),jB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const M={doFill:A,doStroke:k};this._rectRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o,M)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),M.doFill&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),M.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};UB=NB([qw(),WB(0,Qw(sA)),WB(0,Zw(jE)),VB("design:paramtypes",[Object])],UB);var GB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$B=function(t,e){return function(i,n){e(i,n,t)}};let XB=class extends wB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=JT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=SE(f,p),A=AE(f,g),k=bE(d),M=xE(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};XB=GB([qw(),$B(0,Qw(sA)),$B(0,Zw(NE)),YB("design:paramtypes",[Object])],XB);var KB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZB=function(t,e){return function(i,n){e(i,n,t)}};let JB=class extends wB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=QT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=SE(f,p),C=AE(f,g),T=bE(d),E=xE(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const R=!b,P=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===LA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),R&&this.transformUseContext2d(t,h,P,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,P);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,P)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,P),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,P,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,P);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,P))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,P),this.drawUnderLine(_,v,t,i,n+r,P,h,e)))}R&&this.restoreTransformUseContext2d(t,h,P,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=eR(l,g),m=iR(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=eR(h,a),f=iR("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};JB=KB([qw(),ZB(0,Qw(sA)),ZB(0,Zw(VE)),qB("design:paramtypes",[Object])],JB);var QB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tI=class{};function eI(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aI=function(t,e){return function(i,n){e(i,n,t)}};let oI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=$T}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:_=l.visible,x:v=l.x,y:b=l.y}=t.attribute,x=SE(y,p),S=AE(y,f),w=bE(c),A=xE(d,m);t.valid&&_&&(w||A||g)&&(x||S||a||o||g)&&(e.beginPath(),u<=0||en(u)&&u.every((t=>0===t))?eI(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)eI(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=nI(l,y,_,c,d),S=nI(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=iI(w,A),M=nI(l,iI(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,w,A,x,S,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),w&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,v-i,b-n,l),e.fill())),A&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,w,A,x,S,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};oI=sI([qw(),aI(0,Qw(sA)),aI(0,Zw(HE)),rI("design:paramtypes",[Object])],oI);var lI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cI=function(t,e){return function(i,n){e(i,n,t)}};const dI=["","repeat-x","repeat-y","repeat"];let uI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=UT}drawShape(t,e,i,n,s,r,a){const o=jM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=SE(d,u),_=bE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,dI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=jM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};uI=lI([qw(),cI(0,Qw(sA)),cI(0,Zw(FE)),hI("design:paramtypes",[Object])],uI);const pI=Symbol.for("IncrementalDrawContribution"),gI=Symbol.for("ArcRender"),fI=Symbol.for("Arc3dRender"),mI=Symbol.for("AreaRender"),yI=Symbol.for("CircleRender"),_I=Symbol.for("GraphicRender"),vI=Symbol.for("GroupRender"),bI=Symbol.for("LineRender"),xI=Symbol.for("PathRender"),SI=Symbol.for("PolygonRender"),wI=Symbol.for("RectRender"),AI=Symbol.for("Rect3DRender"),kI=Symbol.for("SymbolRender"),MI=Symbol.for("TextRender"),CI=Symbol.for("RichTextRender"),TI=Symbol.for("Pyramid3dRender"),EI=Symbol.for("GlyphRender"),RI=Symbol.for("ImageRender"),PI=Symbol.for("RenderSelector"),BI=Symbol.for("DrawContribution");function II(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function DI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(en(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const LI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return qk(Object.assign({nativeCanvas:$k.global.createCanvas(t)},t));const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr};return qk(Object.assign({nativeCanvas:$k.global.createCanvas(e)},e))}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};var OI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zI=function(t,e){return function(i,n){e(i,n,t)}};let HI=class{constructor(){this.time=LA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=jM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};HI=OI([qw()],HI);let jI=class{constructor(t){this.subRenderContribitions=t,this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};jI=OI([qw(),zI(0,Qw(sA)),zI(0,Zw(WE)),FI("design:paramtypes",[Object])],jI);let NI=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=LI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return LI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,ds),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};NI=OI([qw()],NI);var VI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WI=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=II(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),EE(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=II(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),EE(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};WI=VI([qw()],WI);let UI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};UI=VI([qw()],UI);let GI=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};GI=VI([qw()],GI);var YI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $I=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=II(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=II(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};$I=YI([qw()],$I);let XI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};XI=YI([qw()],XI);let KI=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};KI=YI([qw()],KI);var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};ZI=qI([qw()],ZI);var JI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let QI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=jM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};QI=JI([qw()],QI);var tD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eD=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=II(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||en(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),jB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=II(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||en(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),jB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};eD=tD([qw()],eD);let iD=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};iD=tD([qw()],iD);let nD=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};nD=tD([qw()],nD);let sD=class{constructor(){this.time=LA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};sD=tD([qw()],sD);let rD=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};rD=tD([qw()],rD);var aD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let oD=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=II(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=II(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};oD=aD([qw()],oD);class lD extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}}class hD extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}}var cD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uD=function(t,e){return function(i,n){e(i,n,t)}};const pD=Symbol.for("RenderService");let gD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};gD=cD([qw(),uD(0,Qw(BI)),dD("design:paramtypes",[Object])],gD);var fD=new Gw((t=>{t(gD).toSelf(),t(pD).toService(gD)})),mD=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function yD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return mD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function vD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var bD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const xD=Symbol.for("PickItemInterceptor");let SD=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===HT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=ds;for(;o<0;)o+=ds;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};SD=bD([qw()],SD);var wD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kD=function(t,e){return function(i,n){e(i,n,t)}};const MD=Symbol.for("PickerService");let CD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ls(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=XP.allocate();if(QP(i,e),a){if(i){const t=XP.allocate();r.modelMatrix=tB(t,a,i),XP.free(i)}}else QP(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new As(e.x,e.y),a=jM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new As(e.x,e.y);l.transformPoint(r,r);const a=jM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&XP.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),$P.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};CD=wD([qw(),kD(0,Qw(cA)),kD(1,Qw(sA)),kD(1,Zw(xD)),AD("design:paramtypes",[Object,Object])],CD);var TD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ED=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RD=function(t,e){return function(i,n){e(i,n,t)}};const PD=Symbol.for("GlobalPickerService");let BD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new Ls(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new As(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function ID(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function DD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}BD=TD([qw(),RD(0,Qw(cA)),ED("design:paramtypes",[Object])],BD);class LD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=XP.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=XP.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zD=[0,0,0],HD=new Ls(1,0,0,1,0,0);let jD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},bk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Sk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},wk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ls(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ls(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ls(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return $P.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=ds;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&BE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(DD(zD,[t,e,i],this.modelMatrix),t=zD[0],e=zD[1],i=zD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(DD(zD,[t,e,i],this.modelMatrix),t=zD[0],e=zD[1],i=zD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(DD(zD,[e,i,n],this.modelMatrix),e=zD[0],i=zD[1],n=zD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$k.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=$k.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:wk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:wk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(DD(zD,[e,i,n],this.modelMatrix),e=zD[0],i=zD[1],n=zD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=DI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=II(this,l,this.dpr),r.strokeStyle=DI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=tR(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=tR(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(HD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>$P.free(t))),this.stack.length=0}};jD.env="browser",jD=OD([qw(),FD("design:paramtypes",[Object,Number])],jD);var ND=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const WD={WIDTH:500,HEIGHT:500,DPR:1};let UD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=WD.WIDTH,height:n=WD.HEIGHT,dpr:s=WD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=$k.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new jD(this,this._dpr),this._id=e.id,this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};UD.env="browser",UD=ND([qw(),VD("design:paramtypes",[Object])],UD);const GD=Symbol.for("CanvasArcPicker"),YD=Symbol.for("CanvasArc3dPicker"),$D=Symbol.for("CanvasAreaPicker"),XD=Symbol.for("CanvasCirclePicker"),KD=Symbol.for("CanvasImagePicker"),qD=Symbol.for("CanvasLinePicker"),ZD=Symbol.for("CanvasPathPicker"),JD=Symbol.for("CanvasRectPicker"),QD=Symbol.for("CanvasRect3dPicker"),tL=Symbol.for("CanvasSymbolPicker"),eL=Symbol.for("CanvasTextPicker"),iL=Symbol.for("CanvasPolygonPicker"),nL=Symbol.for("CanvasPyramid3dPicker"),sL=Symbol.for("CanvasRichTextPicker"),rL=Symbol.for("CanvasGlyphPicker"),aL=Symbol.for("CanvasPickerContribution"),oL=Symbol.for("MathArcPicker"),lL=Symbol.for("MathAreaPicker"),hL=Symbol.for("MathCirclePicker"),cL=Symbol.for("MathLinePicker"),dL=Symbol.for("MathPathPicker"),uL=Symbol.for("MathRectPicker"),pL=Symbol.for("MathSymbolPicker"),gL=Symbol.for("MathTextPicker"),fL=Symbol.for("MathPolygonPicker"),mL=Symbol.for("MathGlyphPicker"),yL=Symbol.for("MathPickerContribution");var _L=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bL=function(t,e){return function(i,n){e(i,n,t)}};let xL=class extends CD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new UD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const AL=new Ls(1,0,0,1,0,0),kL={x:0,y:0};let ML=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ls(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ls(1,0,0,1,0,0),this.path=new mk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return $P.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},kL),function(t,e,i){return kM(t,0,!1,e,i)}(this.path.commandList,kL.x,kL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},kL);const i=II(this,this.lineWidth,this.dpr);return function(t,e,i,n){return kM(t,e,!0,i,n)}(this.path.commandList,i,kL.x,kL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(AL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>$P.free(t))),this.stack.length=0}};ML=SL([qw(),wL("design:paramtypes",[Object,Number])],ML);var CL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EL=function(t,e){return function(i,n){e(i,n,t)}};let RL=class extends CD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new ML(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};CL([nA(),TL("design:type",Function),TL("design:paramtypes",[]),TL("design:returntype",void 0)],RL.prototype,"init",null),RL=CL([qw(),EL(0,Qw(sA)),EL(0,Zw(yL)),EL(1,Qw(cA)),EL(2,Qw(sA)),EL(2,Zw(xD)),TL("design:paramtypes",[Object,Object,Object])],RL);var PL=new Gw((t=>{t(xL).toSelf().inSingletonScope(),t(RL).toSelf().inSingletonScope(),t(MD).toService(xL),t(BD).toSelf().inSingletonScope(),t(PD).toService(BD),t(SD).toSelf().inSingletonScope(),t(xD).toService(SD),aA(t,xD)})),BL=new Gw((t=>{t(iB).toSelf().inSingletonScope(),t(tE).toService(iB),t(IP).toSelf().inSingletonScope(),t(BP).toService(IP),aA(t,BP),t(OP).toSelf().inSingletonScope(),t(LP).toService(OP),aA(t,LP),t(HP).toSelf().inSingletonScope(),t(zP).toService(HP),aA(t,zP),t(VP).toSelf().inSingletonScope(),t(NP).toService(VP),aA(t,NP),t(GP).toSelf().inSingletonScope(),t(UP).toService(GP),aA(t,UP),t(eE).toConstantValue(vB)}));const IL=Symbol.for("AutoEnablePlugins"),DL=Symbol.for("PluginService");var LL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FL=function(t,e){return function(i,n){e(i,n,t)}};let zL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Yk.isBound(IL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};zL=LL([qw(),FL(0,Qw(sA)),FL(0,Zw(IL)),OL("design:paramtypes",[Object])],zL);var HL=new Gw((t=>{t(zL).toSelf(),t(DL).toService(zL),aA(t,IL)})),jL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}};NL=jL([qw()],NL);var VL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function UL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let GL=class extends NL{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(an(o)?o:1),y:(s-r.top)/(an(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return UL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return UL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:NM.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}};function YL(){Yk.rebind(MD).toService(RL)}GL=VL([qw(),WL("design:paramtypes",[])],GL);var $L=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KL=class extends NL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),YL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};KL=$L([qw(),XL("design:paramtypes",[])],KL);var qL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JL=class extends NL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Yk.rebind(MD).toService(RL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};JL=qL([qw(),ZL("design:paramtypes",[])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let eO=!1;try{eO=!!lynx.createCanvasNG}catch(t){}let iO=class extends NL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=eO?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,eO&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),YL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};iO=QL([qw(),tO("design:paramtypes",[])],iO);var nO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sO=class extends NL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};sO=nO([qw()],sO);var rO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let lO=class extends NL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return oO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{YL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};lO=rO([qw(),aO("design:paramtypes",[])],lO);var hO=new Gw((t=>{t(GL).toSelf().inSingletonScope(),t(hA).toService(GL),t(KL).toSelf().inSingletonScope(),t(hA).toService(KL),t(JL).toSelf().inSingletonScope(),t(hA).toService(JL),t(iO).toSelf().inSingletonScope(),t(hA).toService(iO),t(lO).toSelf().inSingletonScope(),t(hA).toService(lO),t(sO).toSelf().inSingletonScope(),t(hA).toService(sO),aA(t,hA)})),cO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uO=class{constructor(){this._uid=NM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};uO=cO([qw(),dO("design:paramtypes",[])],uO);var pO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fO=function(t,e){return function(i,n){e(i,n,t)}};let mO=class extends uO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:NM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new UD(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new UD({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};mO.env="browser",mO=pO([qw(),fO(0,Qw(cA)),gO("design:paramtypes",[Object])],mO);var yO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _O=class extends jD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};_O.env="feishu",_O=yO([qw()],_O);var vO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xO={WIDTH:500,HEIGHT:500,DPR:1};let SO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=xO.WIDTH,height:n=xO.HEIGHT,dpr:s=xO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new _O(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};SO.env="feishu",SO=vO([qw(),bO("design:paramtypes",[Object])],SO);var wO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kO=function(t,e){return function(i,n){e(i,n,t)}};let MO=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new SO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new SO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};MO.env="feishu",MO=wO([qw(),kO(0,Qw(cA)),AO("design:paramtypes",[Object])],MO);var CO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TO=class extends jD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(DI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(II(this,l,this.dpr)),r.setStrokeStyle(DI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=tR(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=tR(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};TO.env="taro",TO=CO([qw()],TO);var EO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const PO={WIDTH:500,HEIGHT:500,DPR:1};let BO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=PO.WIDTH,height:n=PO.HEIGHT,dpr:s=PO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new TO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};BO.env="taro",BO=EO([qw(),RO("design:paramtypes",[Object])],BO);var IO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LO=function(t,e){return function(i,n){e(i,n,t)}};let OO=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new BO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new BO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};OO.env="taro",OO=IO([qw(),LO(0,Qw(cA)),DO("design:paramtypes",[Object])],OO);var FO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zO=class extends jD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=II(this,l,this.dpr),r.strokeStyle=DI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};zO.env="lynx",zO=FO([qw()],zO);var HO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const NO={WIDTH:500,HEIGHT:500,DPR:1};let VO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=NO.WIDTH,height:n=NO.HEIGHT,dpr:s=NO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new zO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};VO.env="lynx",VO=HO([qw(),jO("design:paramtypes",[Object])],VO);var WO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GO=function(t,e){return function(i,n){e(i,n,t)}};let YO=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new VO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new VO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};YO.env="lynx",YO=WO([qw(),GO(0,Qw(cA)),UO("design:paramtypes",[Object])],YO);var $O=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KO=class extends jD{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ls(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};KO.env="node",KO=$O([qw(),XO("design:paramtypes",[Object,Number])],KO);var qO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const JO={WIDTH:500,HEIGHT:500,DPR:1};let QO=class{get id(){return this._id}get x(){return 0}get y(){return 0}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=JO.WIDTH,height:n=JO.HEIGHT,canvasControled:s=!0,dpr:r=JO.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new KO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&$i(this._nativeCanvas.release)&&this._nativeCanvas.release()}};QO.env="node",QO=qO([qw(),ZO("design:paramtypes",[Object])],QO);var tF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iF=function(t,e){return function(i,n){e(i,n,t)}};let nF=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new QO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new QO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};nF.env="node",nF=tF([qw(),iF(0,Qw(cA)),eF("design:paramtypes",[Object])],nF);var sF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rF=class extends jD{draw(){}createPattern(t,e){return null}};rF.env="wx",rF=sF([qw()],rF);var aF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const lF={WIDTH:500,HEIGHT:500,DPR:1};let hF=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=lF.WIDTH,height:n=lF.HEIGHT,dpr:s=lF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new rF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};hF.env="wx",hF=aF([qw(),oF("design:paramtypes",[Object])],hF);var cF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uF=function(t,e){return function(i,n){e(i,n,t)}};class pF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let gF=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new pF}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new hF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new hF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};gF.env="wx",gF=cF([qw(),uF(0,Qw(cA)),dF("design:paramtypes",[Object])],gF);var fF=new Gw((t=>{t(mO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(mO))).whenTargetNamed(mO.env),t(MO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(MO))).whenTargetNamed(MO.env),t(OO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(OO))).whenTargetNamed(OO.env),t(YO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(YO))).whenTargetNamed(YO.env),t(gF).toSelf(),t(gE).toDynamicValue((t=>t.container.get(gF))).whenTargetNamed(gF.env),t(nF).toSelf(),t(gE).toDynamicValue((t=>t.container.get(nF))).whenTargetNamed(nF.env)})),mF=new Gw((t=>{t(Gk).toSelf().inSingletonScope(),t(Uk).toService(Gk),aA(t,Uk)})),yF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vF=function(t,e){return function(i,n){e(i,n,t)}};let bF=class{constructor(t){this.global=t,this.offscreen=!1}init(t,e,i){if(this.layer=t,i.main)this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=qk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};bF=yF([qw(),vF(0,Qw(cA)),_F("design:paramtypes",[Object])],bF);var xF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wF=function(t,e){return function(i,n){e(i,n,t)}};let AF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=qk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};AF=xF([qw(),wF(0,Qw(cA)),SF("design:paramtypes",[Object])],AF);var kF=new Gw((t=>{t(bF).toSelf(),t(AF).toSelf(),t(sE).toService(bF)}));var MF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const CF=Symbol.for("DrawItemInterceptor"),TF=new Ts;let EF=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){TF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(TF),!0}};EF=MF([qw()],EF);let RF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=XP.allocate();QP(l,o);const h=r.modelMatrix;if(h){if(l){const t=XP.allocate();r.modelMatrix=tB(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===HT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=ds;for(;o<0;)o+=ds;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&XP.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};RF=MF([qw()],RF);var PF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IF=function(t,e){return function(i,n){e(i,n,t)}};let DF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Cs,this.backupDirtyBounds=new Cs}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=(h=l,c=n.dirtyBounds,d=!1,null===h?c:null===c?h:(Ks=h.x1,qs=h.x2,Zs=h.y1,Js=h.y2,Qs=c.x1,tr=c.x2,er=c.y1,ir=c.y2,d&&(Ks>qs&&([Ks,qs]=[qs,Ks]),Zs>Js&&([Zs,Js]=[Js,Zs]),Qs>tr&&([Qs,tr]=[tr,Qs]),er>ir&&([er,ir]=[ir,er])),Ks>=tr||qs<=Qs||Zs>=ir||Js<=er?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Ks,Qs),y1:Math.max(Zs,er),x2:Math.min(qs,tr),y2:Math.min(Js,ir)}));l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}var h,c,d;this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const u=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),u&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:kk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=vD(e,i,kk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(!ar(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):yD(t,kk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Yk.get(pI);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let OF=class{selector(t){return null}};OF=LF([qw()],OF);var FF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HF=function(t,e){return function(i,n){e(i,n,t)}};let jF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:v=l.path,lineWidth:b=l.lineWidth,visible:x=l.visible}=t.attribute,S=wE(u,m,p,g),w=kE(u,y,p,g),A=bE(h),k=xE(d,b);if(!t.valid||!x)return;if(!f){if(!(A||k||c))return;if(!(S||w||a||o||c))return}if(v&&v.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,v.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===_||en(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),jB(e,i,n,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const M={doFill:A,doStroke:k};this._groupRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o,M)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),M.doFill&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),M.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=jM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=XP.allocate(),i=XP.allocate();eB(i,t,a),tB(e,o||e,i),s.modelMatrix=e,XP.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&XP.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};jF=FF([qw(),HF(0,Qw(sA)),HF(0,Zw(OE)),zF("design:paramtypes",[Object])],jF);var NF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let VF=class extends CB{constructor(){super(...arguments),this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=jM(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,y=SE(u,p),_=AE(u,g),v=bE(c),b=xE(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};VF=NF([qw()],VF);var WF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UF=class extends DB{constructor(){super(...arguments),this.numberType=jT}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=jM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=SE(u,d),f=bE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};UF=WF([qw()],UF);var GF,YF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XF=function(t,e){return function(i,n){e(i,n,t)}},KF=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(GF||(GF={}));let qF=class extends DF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=GF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new lA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return KF(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:kk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return KF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return KF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>KF(this,void 0,void 0,(function*(){if(2!==t.count)yield _D(t,kk.zIndex,((i,n)=>{if(this.status===GF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return KF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return KF(this,void 0,void 0,(function*(){this.rendering&&(this.status=GF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=GF.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return KF(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>KF(this,void 0,void 0,(function*(){yield _D(t,kk.zIndex,(t=>KF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};YF([Qw(cA),$F("design:type",Object)],qF.prototype,"global",void 0),qF=YF([qw(),XF(0,tA(_I)),XF(1,Qw(PI)),XF(2,Qw(VF)),XF(3,Qw(UF)),XF(4,Qw(_E)),XF(5,Qw(sA)),XF(5,Zw(CF)),$F("design:paramtypes",[Array,Object,Object,Object,Object,Object])],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JF=class extends wB{constructor(){super(...arguments),this.type="rect3d",this.numberType=qT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=wE(g,f,u,p),x=kE(g,y,u,p),S=bE(c),w=xE(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=aT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=jM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};JF=ZF([qw()],JF);var QF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tz=class{constructor(){this.numberType=ZT}drawShape(t,e,i,n,s){const r=jM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&SE(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=jM(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),jB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=jM(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};tz=QF([qw()],tz);var ez=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iz=class{constructor(){this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=jM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};iz=ez([qw()],iz);var nz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sz=class extends wB{constructor(){super(...arguments),this.numberType=HT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=SE(p,g),v=AE(p,m),b=bE(c),x=xE(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=aT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},R={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=us(l-o),c=l>o;let d=!1;if(r=ds-os)e.moveTo(i+r*gs(o),n+r*ys(o),s),e.arc(i,n,r,o,l,!c,s),a>os&&(e.moveTo(i+a*gs(l),n+a*ys(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*gs(p),_=r*ys(p),v=a*gs(f),b=a*ys(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>os)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(R[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,ds,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=us(h-l),d=h>l;let u=!1;if(a<=os)e.moveTo(i,n,s);else if(c>=ds-os)e.moveTo(i+a*gs(l),n+a*ys(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*gs(h),n+a*ys(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*gs(c),f=a*ys(c),m=a*gs(p),y=a*ys(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(R[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=jM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};sz=nz([qw()],sz);var rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let az=class extends wB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=XT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=SE(u,p),x=AE(u,f),S=bE(c),w=xE(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=aT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=jM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};az=rz([qw()],az);var oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lz=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};lz=oz([qw()],lz);let hz=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};hz=oz([qw()],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};dz=cz([qw()],dz);let uz=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};uz=cz([qw()],uz);var pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gz=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};gz=pz([qw()],gz);let fz=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:RC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:RC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:RC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:RC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};fz=pz([qw()],fz);var mz=new Gw((t=>{t(DF).toSelf(),t(BI).toService(DF),t(qF).toSelf(),t(pI).toService(qF),t(OF).toSelf(),t(PI).toService(OF),t(ZE).toSelf().inSingletonScope(),t(yI).to(ZE),t(_I).to(ZE),t($I).toSelf().inSingletonScope(),t(XI).toSelf().inSingletonScope(),t(KI).toSelf().inSingletonScope(),t(LE).toService($I),t(LE).toService(XI),t(LE).toService(KI),aA(t,LE),t(UB).toSelf().inSingletonScope(),t(wI).to(UB),t(_I).to(UB),t(JF).toSelf().inSingletonScope(),t(AI).toService(JF),t(_I).toService(AI),t(eD).toSelf().inSingletonScope(),t(iD).toSelf().inSingletonScope(),t(nD).toSelf().inSingletonScope(),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(jE).toService(eD),t(jE).toService(iD),t(jE).toService(nD),t(jE).toService(sD),t(jE).toService(rD),aA(t,jE),t(JB).toSelf().inSingletonScope(),t(MI).to(JB),t(_I).to(JB),aA(t,VE),t(zB).toSelf().inSingletonScope(),t(xI).to(zB),t(_I).to(zB),t(dz).toSelf().inSingletonScope(),t(uz).toSelf().inSingletonScope(),t(zE).toService(dz),t(zE).toService(uz),aA(t,zE),t(XB).toSelf().inSingletonScope(),t(kI).to(XB),t(_I).to(XB),t(oD).toSelf().inSingletonScope(),t(lD).toSelf().inSingletonScope(),t(hD).toSelf().inSingletonScope(),t(NE).toService(oD),t(NE).toService(lD),t(NE).toService(hD),aA(t,NE),t($E).toSelf().inSingletonScope(),t(gI).to($E),t(_I).to($E),t(sz).toSelf().inSingletonScope(),t(fI).toService(sz),t(_I).toService(fI),t(WI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(GI).toSelf().inSingletonScope(),t(IE).toService(WI),t(IE).toService(UI),t(IE).toService(GI),aA(t,IE),t(CB).toSelf().inSingletonScope(),t(bI).to(CB),t(_I).to(CB),t(VF).toSelf().inSingletonScope(),t(UF).toSelf().inSingletonScope(),t(DB).toSelf().inSingletonScope(),t(mI).to(DB),t(_I).to(DB),t(gz).toSelf().inSingletonScope(),t(fz).toSelf().inSingletonScope(),t(DE).toService(gz),t(DE).toService(fz),aA(t,DE),t(jF).toSelf().inSingletonScope(),t(vI).to(jF),t(_I).to(jF),t(ZI).toSelf().inSingletonScope(),t(OE).toService(ZI),aA(t,OE),t(oI).toSelf().inSingletonScope(),t(SI).to(oI),t(_I).to(oI),t(lz).toSelf().inSingletonScope(),t(hz).toSelf().inSingletonScope(),t(HE).toService(lz),t(HE).toService(hz),aA(t,HE),t(iz).toSelf().inSingletonScope(),t(EI).toService(iz),t(_I).toService(EI),t(uI).toSelf().inSingletonScope(),t(RI).toService(uI),t(_I).toService(RI),t(QI).toSelf().inSingletonScope(),t(FE).toService(QI),aA(t,FE),t(tz).toSelf().inSingletonScope(),t(CI).toService(tz),t(_I).toService(CI),t(az).toSelf().inSingletonScope(),t(TI).toService(az),t(_I).toService(TI),t(jI).toSelf().inSingletonScope(),t(VE).toService(jI),t(IE).toService(jI),t(zE).toService(jI),t(NE).toService(jI),t(jE).toService(jI),t(FE).toService(jI),t(LE).toService(jI),t(DE).toService(jI),t(HE).toService(jI),aA(t,WE),aA(t,_I),t(EF).toSelf().inSingletonScope(),t(CF).toService(EF),t(RF).toSelf().inSingletonScope(),t(CF).toService(RF),aA(t,CF)}));var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};let bz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=II(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};bz=yz([qw(),vz(0,Qw(yI)),_z("design:paramtypes",[Object])],bz);var xz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wz=function(t,e){return function(i,n){e(i,n,t)}};const Az=new Ts;let kz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=KT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||rn(r,!0)&&0!==r||en(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=II(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;Az.setValue(i.x1,i.y1,i.x2,i.y2),Az.expand(-r/2),h=!Az.containsPoint(e)}}return n.highPerformanceRestore(),h}};kz=xz([qw(),wz(0,Qw(wI)),Sz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=II(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Ez=Mz([qw(),Tz(0,Qw(gI)),Cz("design:paramtypes",[Object])],Ez);var Rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bz=function(t,e){return function(i,n){e(i,n,t)}};let Iz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=jT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Iz=Rz([qw(),Bz(0,Qw(mI)),Pz("design:paramtypes",[Object])],Iz);var Dz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lz=class{constructor(){this.type="image",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Lz=Dz([qw()],Lz);var Oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fz=class extends wB{};Fz=Oz([qw()],Fz);var zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=jM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=II(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Nz=zz([qw(),jz(0,Qw(bI)),Hz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Gz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=YT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=II(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Gz=Vz([qw(),Uz(0,Qw(xI)),Wz("design:paramtypes",[Object])],Gz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xz=function(t,e){return function(i,n){e(i,n,t)}};let Kz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=JT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=jM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=II(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Kz=Yz([qw(),Xz(0,Qw(kI)),$z("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};let Qz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=QT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=jM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=iR(a,u,s),y=eR(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&XP.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Qz=qz([qw(),Jz(0,Qw(MI)),Zz("design:paramtypes",[Object])],Qz);var tH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iH=function(t,e){return function(i,n){e(i,n,t)}};let nH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=$T}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};nH=tH([qw(),iH(0,Qw(SI)),eH("design:paramtypes",[Object])],nH);var sH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aH=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let oH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ZT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};oH=sH([qw(),aH(0,Qw(CI)),rH("design:paramtypes",[Object])],oH);var lH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cH=function(t,e){return function(i,n){e(i,n,t)}};let dH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};dH=lH([qw(),cH(0,Qw(EI)),hH("design:paramtypes",[Object])],dH);var uH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gH=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let fH=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=qT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};fH=uH([qw(),gH(0,Qw(AI)),pH("design:paramtypes",[Object])],fH);var mH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_H=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let vH=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=XT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};vH=mH([qw(),_H(0,Qw(TI)),yH("design:paramtypes",[Object])],vH);var bH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SH=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let wH=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=HT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};wH=bH([qw(),SH(0,Qw(fI)),xH("design:paramtypes",[Object])],wH);var AH=new Gw(((t,e,i,n)=>{t(bz).toSelf().inSingletonScope(),t(XD).toService(bz),t(aL).toService(XD),t(kz).toSelf().inSingletonScope(),t(JD).toService(kz),t(aL).toService(JD),t(fH).toSelf().inSingletonScope(),t(QD).toService(fH),t(aL).toService(QD),t(Ez).toSelf().inSingletonScope(),t(GD).toService(Ez),t(aL).toService(GD),t(Iz).toSelf().inSingletonScope(),t($D).toService(Iz),t(aL).toService($D),t(Lz).toSelf().inSingletonScope(),t(KD).toService(Lz),t(aL).toService(KD),t(Nz).toSelf().inSingletonScope(),t(qD).toService(Nz),t(aL).toService(qD),t(Gz).toSelf().inSingletonScope(),t(ZD).toService(Gz),t(aL).toService(ZD),t(Kz).toSelf().inSingletonScope(),t(tL).toService(Kz),t(aL).toService(tL),t(Qz).toSelf().inSingletonScope(),t(eL).toService(Qz),t(aL).toService(eL),t(nH).toSelf().inSingletonScope(),t(iL).toService(nH),t(aL).toService(iL),t(vH).toSelf().inSingletonScope(),t(nL).toService(vH),t(aL).toService(nL),t(wH).toSelf().inSingletonScope(),t(YD).toService(wH),t(aL).toService(YD),t(oH).toSelf().inSingletonScope(),t(sL).toService(oH),t(aL).toService(sL),t(dH).toSelf().inSingletonScope(),t(rL).toService(dH),t(aL).toService(rL),aA(t,aL)})),kH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CH=function(t,e){return function(i,n){e(i,n,t)}};let TH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=YT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};TH=kH([qw(),CH(0,Qw(xI)),MH("design:paramtypes",[Object])],TH);var EH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PH=function(t,e){return function(i,n){e(i,n,t)}};let BH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};BH=EH([qw(),PH(0,Qw(yI)),RH("design:paramtypes",[Object])],BH);var IH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LH=function(t,e){return function(i,n){e(i,n,t)}};const OH=new Ts;let FH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=KT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||rn(r,!0)&&0!==r||en(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;OH.setValue(i.x1,i.y1,i.x2,i.y2),OH.expand(-r/2),h=!OH.containsPoint(e)}}return n.highPerformanceRestore(),h}};FH=IH([qw(),LH(0,Qw(wI)),DH("design:paramtypes",[Object])],FH);var zH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jH=function(t,e){return function(i,n){e(i,n,t)}};let NH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};NH=zH([qw(),jH(0,Qw(gI)),HH("design:paramtypes",[Object])],NH);var VH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let GH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=jT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};GH=VH([qw(),UH(0,Qw(mI)),WH("design:paramtypes",[Object])],GH);var YH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XH=function(t,e){return function(i,n){e(i,n,t)}};let KH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};KH=YH([qw(),XH(0,Qw(bI)),$H("design:paramtypes",[Object])],KH);var qH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JH=function(t,e){return function(i,n){e(i,n,t)}};let QH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=JT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};QH=qH([qw(),JH(0,Qw(kI)),ZH("design:paramtypes",[Object])],QH);var tj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ej=class{constructor(){this.type="text",this.numberType=QT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};ej=tj([qw()],ej);var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sj=function(t,e){return function(i,n){e(i,n,t)}};let rj=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=$T}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};rj=ij([qw(),sj(0,Qw(SI)),nj("design:paramtypes",[Object])],rj);var aj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lj=function(t,e){return function(i,n){e(i,n,t)}};let hj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};hj=aj([qw(),lj(0,Qw(EI)),oj("design:paramtypes",[Object])],hj);var cj=new Gw((t=>{t(BH).toSelf().inSingletonScope(),t(hL).toService(BH),t(yL).toService(hL),t(FH).toSelf().inSingletonScope(),t(uL).toService(FH),t(yL).toService(uL),t(NH).toSelf().inSingletonScope(),t(oL).toService(NH),t(yL).toService(oL),t(GH).toSelf().inSingletonScope(),t(lL).toService(GH),t(yL).toService(lL),t(KH).toSelf().inSingletonScope(),t(cL).toService(KH),t(yL).toService(cL),t(TH).toSelf().inSingletonScope(),t(dL).toService(TH),t(yL).toService(dL),t(QH).toSelf().inSingletonScope(),t(pL).toService(QH),t(yL).toService(pL),t(ej).toSelf().inSingletonScope(),t(gL).toService(ej),t(yL).toService(gL),t(rj).toSelf().inSingletonScope(),t(fL).toService(rj),t(yL).toService(fL),t(hj).toSelf().inSingletonScope(),t(mL).toService(hj),t(hj).toService(mL),aA(t,yL)}));var dj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new UD(t))).whenTargetNamed(UD.env),t(Kk).toDynamicValue((()=>(t,e)=>new jD(t,e))).whenTargetNamed(jD.env)})),uj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new BO(t))).whenTargetNamed(BO.env),t(Kk).toDynamicValue((()=>(t,e)=>new TO(t,e))).whenTargetNamed(TO.env)})),pj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new SO(t))).whenTargetNamed(SO.env),t(Kk).toDynamicValue((()=>(t,e)=>new _O(t,e))).whenTargetNamed(_O.env)})),gj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new VO(t))).whenTargetNamed(VO.env),t(Kk).toDynamicValue((()=>(t,e)=>new zO(t,e))).whenTargetNamed(zO.env)})),fj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new hF(t))).whenTargetNamed(hF.env),t(Kk).toDynamicValue((()=>(t,e)=>new rF(t,e))).whenTargetNamed(rF.env)})),mj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new QO(t))).whenTargetNamed(QO.env),t(Kk).toDynamicValue((()=>(t,e)=>new KO(t,e))).whenTargetNamed(KO.env)}));Yk.load(vE),Yk.load(BL),Yk.load(fD),Yk.load(PL),Yk.load(HL),function(t){t.load(hO),t.load(fF),t.load(mF),t.load(kF)}(Yk),function(t){t.load(mz)}(Yk),function(t){t.load(AH),t.load(cj)}(Yk),function(t){t.load(dj),t.load(pj),t.load(uj),t.load(gj),t.load(fj),t.load(mj)}(Yk);const yj=Yk.get(cA);$k.global=yj;const _j=Yk.get(yE);$k.graphicUtil=_j;const vj=Yk.get(mE);$k.transformUtil=vj;const bj=Yk.get(tE);$k.graphicService=bj,Yk.get(PD);const xj=Yk.get(_E);$k.layerService=xj;class Sj{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,$k.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),$k.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){$k.graphicService.hooks.onAttributeUpdate.taps=$k.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.onSetStage.taps=$k.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class wj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class Aj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,$k.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),$k.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){$k.graphicService.hooks.onAddIncremental.taps=$k.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.onClearIncremental.taps=$k.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,$k.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const kj=new Ts;class Mj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),$k.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(kj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(kj,t.parent&&t.parent.globalTransMatrix)))})),$k.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),$k.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){$k.graphicService.hooks.beforeUpdateAABBBounds.taps=$k.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.afterUpdateAABBBounds.taps=$k.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.onRemove.taps=$k.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Cj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===lC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=lC.INITIAL,$k.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),$k.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:oC},{mode:"timeout",cons:aC},{mode:"manual",cons:rC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==lC.INITIAL&&(this.status=lC.PAUSE,!0)}resume(){return this.status!==lC.INITIAL&&(this.status=lC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===lC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===lC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=lC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=lC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Cj.addTimeline(cC),Cj.setFPS(60);class Tj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=aT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=_s(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=ms(fs((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=tn(e)?aT.get(e).value:e;const r=this.colorRgb;return aT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const Ej="white";class Rj extends nE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Ej}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new zM,this.hooks={beforeRender:new lA(["stage"]),afterRender:new lA(["stage"])},this.global=Yk.get(cA),this.window=Yk.get(pE),this.renderService=Yk.get(pD),this.pickerService=Yk.get(MD),this.pluginService=Yk.get(DL),this.layerService=Yk.get(_E),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Ts,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Ej,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new tC({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Cj,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new Tj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new LD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new wj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new Sj))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Aj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Cs;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new Mj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.afterDraw((t=>{t.removeAllChild()}))}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new As(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Yk.get(pE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Pj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Pj||(Pj={}));const Bj="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Ij=Bj,Dj=14,Lj=18,Oj=4,Fj={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Dj}}},zj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Dj}}},Hj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Dj,offset:12,position:"outside"}}},jj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Dj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Dj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Dj,fill:"#707070",textBaseline:"middle"}}},Nj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Dj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Dj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Dj,fill:"#707070",textBaseline:"middle"}}},Vj="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",Wj={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:Vj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Vj,fill:"#ddd"}}},Uj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Dj}}},Gj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Yj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Dj,fontWeight:"normal",fillOpacity:1}}},$j={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Dj}}},Xj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Dj}}},Kj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Dj}}},qj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Dj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Dj}}},Zj={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Dj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Dj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Dj,textBaseline:"middle",textAlign:"center"}}},Jj="__VCHART",Qj=500,tN=500,eN=`${Jj}_LABEL_LIMIT`,iN=`${Jj}_LABEL_ALIGN`,nN=`${Jj}_LABEL_TEXT`,sN=`${Jj}_LABEL_VISIBLE`,rN=`${Jj}_LABEL_X`,aN=`${Jj}_LABEL_Y`,oN=`${Jj}_ARC_RATIO`,lN=`${Jj}_ARC_START_ANGLE`,hN=`${Jj}_ARC_END_ANGLE`,cN=`${Jj}_ARC_K`,dN=`${Jj}_ARC_LABEL_HOVER_AX`,uN=`${Jj}_ARC_LABEL_HOVER_AY`,pN=`${Jj}_ARC_LABEL_POINT_AX`,gN=`${Jj}_ARC_LABEL_POINT_AY`,fN=`${Jj}_ARC_LABEL_POINT_BX`,mN=`${Jj}_ARC_LABEL_POINT_BY`,yN=`${Jj}_ARC_LABEL_POINT_CX`,_N=`${Jj}_ARC_LABEL_POINT_CY`,vN=`${Jj}_ARC_LABEL_SELECTED_AX`,bN=`${Jj}_ARC_LABEL_SELECTED_AY`,xN=`${Jj}_ARC_MIDDLE_ANGLE`,SN=`${Jj}_ARC_QUADRANT`,wN=`${Jj}_ARC_RADIAN`,AN=-Math.PI/2,kN=3*Math.PI/2,MN=-90,CN=270,TN=.6,EN={},RN=[],PN=(t,e,i)=>{EN[t]=Object.assign(e,{type:t}),i||RN.push(t)},BN=()=>{RN.slice().forEach((t=>{(t=>{delete EN[t];const e=RN.indexOf(t);e>=0&&RN.splice(e,1)})(t)}))};function IN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:tn(t)?t:Xi(s=t)?null:s.fname})):null}function DN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function LN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const ON=":vGrammar_identifier:";function FN(t,e){return Cn(t).reduce(((t,i)=>{const n=tn(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function zN(t,e){if(Xi(t))return[];if(!$i(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(tn(i))return Cn(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!$i(t)&&!!(null==t?void 0:t.callback)}(t))return FN(t.dependency,e);var i;return[]}function HN(t){return $i(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function jN(t,e,i,n){if(Xi(t))return t;if($i(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return tn(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function NN(t,e){return VN(t)?t.output():e[t]}const VN=t=>t&&!Xi(t.grammarType),WN=t=>$i(t)?t:e=>e[t],UN=t=>tn(t)&&Ws.parseColorString(t)?t:null;function GN(t){return!!(null==t?void 0:t.scale)}function YN(t){return!!(null==t?void 0:t.field)}function $N(t,e){if(!t)return[];let i=[];return t.scale&&(i=VN(t.scale)?[t.scale]:Cn(e.getScaleById(t.scale))),i.concat(zN(t,e))}class XN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return tn(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Cn(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const KN={},qN=t=>KN[t],ZN=(t,e,i,n,s)=>(KN[t]=new XN(e,i,n,s),KN[t]);function JN(t){return null===t?0:t}function QN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const tV=["fillOpacity","x","y","dx","dy"],eV=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=JN(i.x),["x"]):"y"===e?(t.y=JN(i.y),["y"]):"dx"===e?(t.dx=JN(i.dx),["dx"]):"dy"===e?(t.dy=JN(i.dy),["dy"]):[]};var iV,nV,sV,rV,aV,oV,lV,hV,cV,dV,uV,pV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(iV||(iV={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(nV||(nV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(sV||(sV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(rV||(rV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(aV||(aV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(oV||(oV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(lV||(lV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(hV||(hV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(cV||(cV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(dV||(dV={})),function(t){t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd"}(uV||(uV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(pV||(pV={}));const gV={[nV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;an(e.width)||!an(e.x1)&&an(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):an(e.x1)||!an(e.width)&&an(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),an(e.height)||!an(e.y1)&&an(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):an(e.y1)||!an(e.height)&&an(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;an(e.width)||!an(e.x1)&&an(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):an(e.x1)||!an(e.width)&&an(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),an(e.height)||!an(e.y1)&&an(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):an(e.y1)||!an(e.height)&&an(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),an(e.length)||!an(e.z1)&&an(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):an(e.z1)||!an(e.length)&&an(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[nV.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[nV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return an(e)&&an(i)&&an(n)&&an(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[nV.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const fV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=tn(t)?gV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(tV.includes(r)?eV(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{tV.includes(t)?eV(s,t,e):s[t]=e[t]}));return s},mV=(t,e,i)=>!(!Xi(t)||!Xi(e))||!Xi(t)&&!Xi(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(tn(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function yV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case nV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case nV.group:case nV.rect:case nV.image:return["width","height","y1"].includes(e);case nV.path:case nV.shape:return["path","customPath"].includes(e);case nV.line:return"defined"===e;case nV.area:return["x1","y1","defined"].includes(e);case nV.rule:return["x1","y1"].includes(e);case nV.symbol:return"size"===e;case nV.polygon:return"points"===e;case nV.text:return"text"===e}return!1}function _V(t,e,i,n,s){i&&(HN(i)?e.forEach((e=>{const s=jN(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=s&&!yV(t.mark.markType,r)?[e[0]]:e;if(GN(l)){const t=NN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!Xi(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=tn(null==l?void 0:l.field),c=s?dl(l.field):null;let d=s?null:Xi(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((n=>{var a;s&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(n.datum))),n.nextAttrs[r]=rn(d)||rn(i)?d+e+i:d}))}else if(YN(l)){const t=dl(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=jN(l,n,e.datum,t)}))})))}function vV(t,e,i,n){if(!t)return null;if(HN(t))return jN(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(GN(h)){const t=NN(h.scale,n),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!Xi(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=tn(null==h?void 0:h.field),u=d?dl(h.field):null,p=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,u(e)):Xi(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);s[r]=rn(p)||rn(c)?p+i+c:p}else if(YN(h)){const t=dl(h.field);s[r]=t(e)}else s[r]=jN(h,n,e,i)})),s}function bV(t){if(t)return t.type===jl.Band?t.bandwidth():t.type===jl.Point?t.step():void 0}const xV={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=$i(i)?i:ml(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!Xi(s)){if(Xi(t))return;t[s]=e}return e})),e;const r=n(e,i);return Xi(s)||Xi(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=ll();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=dl(a),h=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),c=Xi(t.default)?null:t.default,d=s.map((t=>dl(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),Xi(n)&&(n=o);const t=o.map((t=>dl(t)));return e.map((e=>d.reduce(((i,s,r)=>{const a=h[s(e)],l=o.length;return(Xi(a)?t.map((t=>c)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>d.reduce(((e,i,s)=>{const r=h[i(t)];return e[n[s]]=Xi(r)?c:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=IN(i,t.as||[]),s=i.map((t=>tn(t)?dl(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Bn(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],b=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),b=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),x=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),S=an(x*_)?x/_:null,w=an(_*_)?_/b:null;return d&&(y[d]=b),p&&(y[p]=x),r&&(y[r]=S),a&&(y[a]=0===i?1:w),o&&(y[o]=!0===g?S:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:x/v[1]),c&&(y[c]=0===i?1:b/v[1]),u&&(y[u]=_),y}));return b},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=DN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=LN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return LN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;Xi(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=Xi(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=Xi(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{Xi(n[ON])&&(n[ON]=0);let s=n[ON];const r=t.as;return e.forEach((t=>{t&&Xi(t[r])&&(s+=1,t[r]=s)})),n[ON]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=bV(a.y),l="y"===t.dodgeChannel||Xi(t.dodgeChannel)&&o>0?"y":"x",h="y"===l?o:bV(a.x);if(h>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!Xi(t.dodgeBy)){const e=nl(Cn(t.dodgeBy));o=t=>e(t.getDatum())}const c=[];e.forEach((t=>{const e=o(t);c.includes(e)||c.push(e)}));const d=c.length;if(d<1)return e;const u=vl(a,h);let p=u>=h?h:h-u;const g=vl(i,p);let f=(p-Math.max(d-1,0)*g)/d;f>t.maxWidth?(p-=(f-t.maxWidth)*d,f=t.maxWidth):f{m[t]=-p/2+e*(f+g)}));const y=r.markType;"rect"===y||"interval"===y?e.forEach((t=>{const e=o(t),i=m[e],n=t.getItemAttribute();if("x"===l){const e={x:(Xi(n.width)&&!Xi(n.x1)?Math.min(n.x,n.x1):n.x)+(Xi(n.width)?Xi(n.x1)?h:Math.abs(n.x1-n.x):n.width)/2+i};Xi(n.width)?e.x1=e.x+f:e.width=f,t.setItemAttributes(e)}else if("y"===l){const e={y:(Xi(n.height)&&!Xi(n.y1)?Math.min(n.y,n.y1):n.y)+(Xi(n.height)?Xi(n.y1)?h:Math.abs(n.y1-n.y):n.height)/2+i};Xi(n.height)?e.y1=e.y+f:e.height=f,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=m[e];if("x"===l){const e=t.getItemAttribute("x")+h/2;t.setItemAttributes({x:e+i+f/2})}else if("y"===l){const e=t.getItemAttribute("y")+h/2;t.setItemAttributes({y:e+i+f/2})}}))}return e},markPhase:"afterEncodeItems"}},SV="__vgrammar_scene_item__",wV=[nV.line,nV.area],AV=[nV.arc3d,nV.rect3d,nV.pyramid3d],kV="key",MV=[{}],CV=["key"],TV="VGRAMMAR_IMMEDIATE_ANIMATION",EV=0,RV=1e3,PV=0,BV=!1,IV=!1,DV="quintInOut",LV={stopWhenStateChange:!1,immediatelyApply:!0},OV={},FV=t=>OV[t],zV=(t,e)=>{OV[t]={creator:e}};class HV extends nE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new mk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Ok.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new mk;let a,o;r.clear();const l=rn(s)?s:fs(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(uV.BEFORE_CREATE_VRENDER_MARK),e===nV.largeRects)return new HV(i);if(e===nV.largeSymbols)return new jV(i);const n=NV[e]?NV[e](i):FV(e)?FV(e).creator(i):null;return t.emit(uV.AFTER_CREATE_VRENDER_MARK),n}function WV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(uV.BEFORE_CREATE_VRENDER_MARK);const n=new eP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=NV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(uV.AFTER_CREATE_VRENDER_MARK),n}const UV=t=>{t&&(t[SV]=null,t.release(),t.parent&&t.parent.removeChild(t))};class GV{constructor(t){this.data=null,this.states=[],this.diffState=iV.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if($i(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));_V(this,o,a,this.mark.parameters());const l=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=l):this.graphicItem.states={[t]:l},l},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[SV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?fV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;Xi(t.clip)||this.graphicItem.setAttribute("clip",t.clip),Xi(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),Xi(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===iV.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(uV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=WN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(uV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=Cn(jN(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===iV.unChange&&(this.diffState=iV.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==iV.enter&&this.diffState!==iV.update||!this.states.length||this.useStates(this.states),this.mark.markType===nV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new mk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===iV.enter?(r&&_V(this,t,r,i,o),s&&_V(this,t,s,i,o)):this.diffState===iV.update?(n&&r&&_V(this,t,r,i,o),s&&_V(this,t,s,i,o)):this.diffState===iV.exit&&a&&_V(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=Yi(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=Cn(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&tn(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=Cn(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(uV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=Yi(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(uV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)_l(n,i,t)&&fn(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=null==l?void 0:l.nextAttrs;if(t&&t.length&&Xi(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||QN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[nV.line,nV.area,nV.largeRects,nV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),c=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),d=t.map((t=>t.nextAttrs)),u=this.mark.isProgressive();if(h=Object.assign({},h),delete h.x,delete h.y,e===nV.line||e===nV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>QN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=JN(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=JN(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=JN(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=JN(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===nV.area);if(c&&!u){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>mV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=fV(nV.line,t.attrs,i);return n.points=e.slice(t.startIndex,Xi(t.endIndex)?e.length:t.endIndex),n})):null}(d,t,this);e?Object.assign(h,{segments:e,points:null}):Object.assign(h,{points:t,segments:null})}else u?Object.assign(h,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(h,{points:s,segments:null})}else e===nV.largeRects?h.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=JN(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=JN(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=JN(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=JN(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===nV.largeSymbols&&(h.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=JN(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=JN(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return h}applyGraphicAttributes(t){if(!un(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!Xi(e=pn(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return pn(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!fn(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!fn(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(UV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(UV(this.graphicItem),this.graphicItem[SV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?Xi(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):Xi(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?en(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const YV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(an(e.center.x)&&(s.x=e.center.x),an(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},$V=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),XV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const KV=["visible","path","text","lineWidth","textBaseline","textAlign"],qV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=an(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=an(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=an(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=an(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=Un(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:an(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=Un(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:an(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),h=t.getGraphicItem().attribute.x,c=t.getGraphicItem().attribute.y,d=t.getGraphicItem().attribute.width,u=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:h+d/2,x1:h+d/2,width:Xi(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:c+u/2,y1:c+u/2,height:Xi(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:h+d/2,x1:h+d/2,y:c+u/2,y1:c+u/2,width:Xi(o)?void 0:0,height:Xi(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:Xi(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:Xi(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:Xi(n)?void 0:0,height:Xi(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:Xi(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:Xi(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:Xi(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:Xi(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:Xi(n)?void 0:0}}:{to:{x:s,x1:s,width:Xi(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:Xi(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:Xi(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:Xi(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:Xi(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:Xi(n)?void 0:0}}:{to:{y:s,y1:s,height:Xi(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=rn(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=rn(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:YV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:YV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:$V(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:$V(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:XV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:XV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return KV.forEach((t=>{delete n[t],delete s[t]})),Cn(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{_l(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},ZV=Object.assign({},qV),JV=t=>ZV[t],QV=(t,e)=>{ZV[t]=e},tW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!an(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return an(d)&&(m.from.min=l,m.to.min=d),an(u)&&(m.from.max=l,m.to.max=u),an(p)&&(m.from.q1=l,m.to.q1=p),an(g)&&(m.from.q3=l,m.to.q3=g),an(f)&&(m.from.median=l,m.to.median=f),m},eW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!an(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return an(d)&&(m.to.min=l,m.from.min=d),an(u)&&(m.to.max=l,m.from.max=u),an(p)&&(m.to.q1=l,m.from.q1=p),an(g)&&(m.to.q3=l,m.from.q3=g),an(f)&&(m.to.median=l,m.from.median=g),m},iW=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(an(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return an(f)?f:an(_)&&an(v)?(_+v)/2:an(m)&&an(y)?(m+y)/2:an(y)?y:an(m)?m:NaN},nW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(an(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),an(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(an(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),an(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const sW=(t,e,i)=>{var n,s,r,a;if(an(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return an(o)?o:an(c)&&an(d)?(c+d)/2:an(l)&&an(h)?(l+h)/2:an(h)?h:an(l)?l:NaN},rW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(an(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),an(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(an(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),an(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const aW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},oW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},lW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?oW:aW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},hW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{Xi(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},cW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{Xi(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},dW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{Xi(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function uW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(kV,i?t.slice().sort(i):t.slice()),{keys:CV,data:n};const s=WN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class pW{constructor(t,e,i){this.prevData=uW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const gW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{Xi(i[t])&&delete i[t]}));const n=QN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{Xi(i[t])&&delete i[t]}));const n=QN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const fW=(t,e,i,n,s)=>$i(i)?i(t.getDatum(),t,s):i;class mW extends dC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class yW extends dC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{Xi(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:EA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:EA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}pC.mode|=PA.SET_ATTR_IMMEDIATELY;let _W=0;const vW=t=>!Xi(t)&&t.prototype instanceof dC;class bW{constructor(t,e,i){this.id=_W++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),an(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=$i(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!JV(e.type))return null;const r=JV(e.type)(t,s,i);return gW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return en(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):qi(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!Xi(null===(r=s[i])||void 0===r?void 0:r.from),l=!Xi(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?fW(t,0,s[i].from,0,n):void 0,e.to[i]=l?fW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),gW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),l=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const h=vW(o);return Xi(o)||vW(o)?h?new o(a.from,a.to,r,t.easing,l):a.to?new yW(a.from,a.to,r,t.easing):void 0:new mW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!Xi(t)));1===e.length?t.play(e[0]):t.play(new HC(r,e))}}}function xW(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(SW(i,t[i]))})),e}function SW(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Cn(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,h,c,d;if(Xi(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:EV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:IV,loop:null!==(n=l.loop)&&void 0!==n?n:BV,controlOptions:xn({},LV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:RV,delay:null!==(a=l.delay)&&void 0!==a?a:PV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:DV,customParameters:l.customParameters,options:l.options}]}]}}const u=Cn(t.timeSlices).filter((t=>t.effects&&Cn(t.effects).filter((t=>t.channel||t.type)).length));if(u.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:EV,totalTime:t.totalTime,oneByOne:null!==(h=t.oneByOne)&&void 0!==h?h:IV,loop:null!==(c=t.loop)&&void 0!==c?c:BV,controlOptions:xn({},LV,null!==(d=t.controlOptions)&&void 0!==d?d:{}),timeSlices:u.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:PV,effects:Cn(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:DV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function wW(t,e,i){return $i(t)?t.call(null,e.getDatum(),e,i):t}class AW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!Xi(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class kW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=xW(null!=e?e:{})}updateConfig(t){this.configs=xW(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==iV.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new AW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=SW(TV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new AW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return Xi(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=Cn(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Cn(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Cn(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===iV.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(Xi(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},o),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new bW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===iV.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(uV.ANIMATION_START,d),this.mark.emit(uV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=jN(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=wW(t.startTime,e,s),o=wW(t.totalTime,e,s),l=wW(t.oneByOne,e,s),h=wW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=wW(t.delay,e,s),l=null!==(i=wW(t.duration,e,s))&&void 0!==i?i:o/n,h=Cn(t.effects).map((t=>Object.assign({},t,{customParameters:wW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=rn(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:rn(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===iV.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===iV.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===TV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===iV.exit&&0===a[iV.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(uV.ANIMATION_END,h),this.mark.emit(uV.ELEMENT_ANIMATION_END,h,i)}}const MW=(t,e)=>VN(t)?t.output():t&&qi(t)?$i(t.callback)?i=>t.callback(i,e):$i(t.value)?t.value(e):t:t,CW=(t,e)=>t?qi(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=MW(s,e),i}),{}):t.map((t=>MW(t,e))):t;var TW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let EW=-1;class RW extends Ui{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++EW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Cn(this.spec.dependency).map((t=>tn(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Cn(t).map((t=>tn(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return Cn(t).filter((t=>!Xi(t))).forEach((i=>{var n;Xi(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Cn(t).filter((t=>!Xi(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return Xi(this.spec[e])||this.detach(zN(this.spec[e],this.view)),this.spec[e]=t,this.attach(zN(t,this.view)),this.commit(),this}}const PW=(t,e,i)=>{var n,s;if("callback"===t&&$i(e))return{references:[],value:{callback:e,dependency:[]}};if(!Xi(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!Xi(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!Xi(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=zN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},BW=(t,e)=>{const i=(n=t.type,EN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(FN(a,e))));const o=((t,e,i)=>{if(Xi(e))return{value:e};if(en(e)){const n=e.map((e=>PW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return PW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},IW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=BW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class DW extends GV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if($i(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return _V(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[SV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?fV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(uV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=Yi(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(uV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===iV.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==iV.enter&&this.diffState!==iV.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!Xi(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===iV.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=fV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{fn(this.items[0].nextAttrs,e)||fn(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=gV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{fn(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===nV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return wV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&fn(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),fn(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),fn(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)_l(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[SV]=null})),this.glyphGraphicItems=null),super.release()}}const LW=t=>t.markType===nV.glyph?new DW(t):new GV(t);function OW(t){return Xi(t.offsetX)?Xi(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function FW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return an(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),an(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&an(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&an(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const zW="window",HW="view",jW={trap:!1},NW="default",VW="width",WW="height",UW="viewWidth",GW="viewHeight",YW="padding",$W="viewBox",XW="autoFit";function KW(t,e,i,n,s){if(s===zW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{FW(t,OW(t),!1)}))}));const e=OW(t);FW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var qW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class ZW extends RW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new kW(this,{}),this.differ=new pW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=tn(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=tn(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!Xi(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===iV.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===dV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:MV,e);let n=i;i.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(uV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(uV.AFTER_MARK_JOIN),this.emit(uV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(uV.AFTER_MARK_STATE),this.emit(uV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(uV.AFTER_MARK_ENCODE)}return this.emit(uV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(uV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>Xi(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return qW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,Xi(t)||(tn(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return tn(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];HN(i)?this.detach($N(i,this.view)):tn(e)?this.detach($N(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach($N(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return tn(e)?(this.spec.encode[t][e]=i,this.attach($N(i,this.view))):HN(e)?(this.spec.encode[t]=e,this.attach($N(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach($N(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=IW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=IW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{Xi(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{Xi(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return wV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!Xi(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===iV.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];HN(s)||Object.keys(s).forEach((t=>{GN(s[t])&&(e[t]=NN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[SV];if((null==n?void 0:n.mark)===this){const i=KW(this.view,t,n,e,HW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new kW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=NN(this.spec.group,e);this.group=t,t&&(this.emit(uV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(uV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==nV.group){if(!this.graphicItem){const t=VV(this,nV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||AV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==nV.group?(Xi(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),Xi(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=WN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>kV),a=WN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>kV),o=this.spec.sort,l=this.spec.groupSort,h=this.isCollectionMark(),c=new Set(this.elements.filter((t=>t.diffState===iV.enter))),d=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(Xi(e))s=this.elementMap.get(n),s&&(s.diffState=iV.exit);else if(Xi(i)){s=this.elementMap.has(n)?this.elementMap.get(n):LW(this),s.diffState===iV.exit&&(s.diffState=iV.enter,this.animate.getElementAnimators(s,iV.exit).forEach((t=>t.stop("start")))),s.diffState=iV.enter;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),d.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=iV.update;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),d.push(s)}c.delete(s)}));const u=null!=t?t:MV;this.differ.setCurrentData(uW(u,h?a:t=>`${a(t)}-${r(t)}`,h?l:void 0)),this.differ.doDiff(),c.forEach((t=>{this.elementMap.delete(h?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=d,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(uV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(uV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:VV(this,this.markType,t);if(this.emit(uV.BEFORE_ADD_VRENDER_MARK),this.markType===nV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(uV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==nV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=uW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=WN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>kV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=LW(this);e.diffState=iV.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=LW(this);i.diffState=iV.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(HN(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===nV.glyph&&qN(i)){const t=qN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>yV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{yV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(uV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(uV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(yV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(uV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(uV.AFTER_MARK_JOIN),this.emit(uV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(uV.AFTER_MARK_STATE),this.emit(uV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(uV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(uV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(uV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||CV).forEach((t=>{const e=VV(this,nV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(uV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(uV.AFTER_MARK_STATE),this.emit(uV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(uV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==iV.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return gV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=iV.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&UV(this.graphicItem),this.detachAll(),super.release()}}class JW extends ZW{constructor(t,e,i){super(t,nV.component,i),this._componentDatum={[kV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:FV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,kV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[kV]+=1}evaluateJoin(t){return this.spec.key=kV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=tn(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=tn(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const QW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class tU extends nE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){Ji(this.attribute[t])?xn(this.attribute[t],e):this.attribute[t]=e,QW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>QW.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){Xi(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=Kn(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=Kn(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===yj.env?(yj.addEventListener("pointermove",this._onSliderPointerMove),yj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===yj.env?(yj.removeEventListener("pointermove",this._onSliderPointerMove),yj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=qn(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(qn(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Tr(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=Tr(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=qn(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?qn([a+i*s,a+n*s],a,s-l):qn([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new XM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function iU(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&iU(t,e)}))}eU.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const nU=t=>!Xi(t)&&!1!==t.visible,sU=["#ffffff","#000000"];function rU(t,e,i,n,s){const r=hU(t),a=hU(e);return aU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...sU);for(const s of r)if(t!==s&&aU(s,e,i,n))return s}(r,a,i,n,s)}function aU(t,e,i,n){return n?oU(t,e)>n:"largeText"===i?oU(t,e)>3:oU(t,e)>4.5}function oU(t,e){const i=lU(t),n=lU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function lU(t){const e=Gs(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function hU(t){if(null==t?void 0:t.includes("#"))return t;const e=new Ws(t),{r:i,g:n,b:s}=e.color;return"#"+Ys(i,n,s)}function cU(t,e){return[t[0]*e,t[1]*e]}function dU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const uU=-.5*Math.PI,pU=1.5*Math.PI,gU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var fU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(fU||(fU={}));const mU={[fU.selectedReverse]:{},[fU.selected]:{},[fU.hover]:{},[fU.hoverReverse]:{}},yU=(t,e,i)=>new wr(Object.assign({defaultFontParams:{fontFamily:gU,fontSize:11},getTextBounds:i?void 0:xB,specialCharSet:"-/: .,@%'\"~"+wr.ALPHABET_CHAR_SET+wr.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function _U(t,e){var i,n;if(!t)return{width:0,height:0};const s=xB({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var vU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);so&&(g=o,x.setAttribute("maxLineWidth",o-d[1]-d[2])));let E=0,R=0;"center"===C?(E-=g/2,p&&p.setAttribute("x",(p.attribute.x||0)-w/2),u.setAttribute("x",-y/2)):"right"===C||"end"===C?(E-=g,p&&p.setAttribute("x",(p.attribute.x||0)-w),u.setAttribute("x",-d[1]-y)):"left"!==C&&"start"!==C||u.setAttribute("x",d[3]),"middle"===T?(R-=f/2,p&&p.setAttribute("y",0)):"bottom"===T?(R-=f,p&&p.setAttribute("y",-A/2),u.setAttribute("y",-d[2])):"top"===T&&(u.setAttribute("y",d[0]),p&&p.setAttribute("y",A/2));const{visible:P}=s,B=vU(s,["visible"]);if(h&&Yi(P)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},B),{visible:P&&!!e,x:E,y:R,width:g,height:f}),"rect");un(null==c?void 0:c.panel)||(t.states=c.panel)}}}bU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};class xU extends tU{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class SU extends xU{constructor(t){super(xn({},SU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}SU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class wU extends xU{constructor(t){super(xn({},wU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}wU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class AU extends xU{constructor(t){super(xn({},AU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=ks.distancePP(t,e);this.setAttribute("radius",i)}}AU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class kU extends xU{constructor(t){super(xn({},kU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=uU,endAngle:n=pU}=this.attribute,s=n-i,r=Rs(Ds(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}kU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class MU extends xU{constructor(t){super(xn({},MU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=Is(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=ks.distancePP(t,e);this.setAttribute("radius",i)}}MU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const CU=new Uint32Array(33),TU=new Uint32Array(33);TU[0]=0,CU[0]=~TU[0];for(let t=1;t<=32;++t)TU[t]=TU[t-1]<<1|1,CU[t]=~TU[t];function EU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&CU[31&n]&TU[1+(31&s)])return!0}else{if(i[r]&CU[31&n])return!0;if(i[a]&TU[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,CU[31&i]&TU[1+(31&s)]);else for(n(r,CU[31&i]),n(a,TU[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,TU[31&i]|CU[1+(31&n)]);else for(s(r,TU[31&i]),s(a,CU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function RU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=Kn(i,0,t.width),o=Kn(n,0,t.width),l=Kn(s,0,t.height),h=Kn(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function PU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=RU(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function BU(t,e){return!(!t||!e)&&e.encloses(t)}function IU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return IU(t,e,s,l,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?$i(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return IU(t,e,s,r,null===(l=n.overlap)||void 0===l?void 0:l.clampForce)}if("moveX"===i.type){const r=(i.offset?$i(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return IU(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}return!1}const LU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],OU=["top","inside-top","inside"];const FU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function zU(t,e){var i,n;return null!==(n=null===(i=FU[e])||void 0===i?void 0:i.call(FU,t))&&void 0!==n?n:{from:{},to:{}}}const HU="same-time",jU=300,NU="linear";class VU extends tU{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||un(e.states)||(e.addState(fU.hover,!0),iU(this,(t=>{t===e||un(t.states)||t.addState(fU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(iU(this,(t=>{un(t.states)||(t.removeState(fU.hoverReverse),t.removeState(fU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void iU(this,(t=>{un(t.states)||(t.removeState(fU.selectedReverse),t.removeState(fU.selected))}));un(e.states)||(e.addState(fU.selected,!0),iU(this,(t=>{t===e||un(t.states)||t.addState(fU.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!un(e)&&(t.states=e)}_createLabelText(t){const e=gB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if($i(s)&&(s=s({})),!s||0===s.length)return[];let r=[];$i(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],l=this.getBaseMarkGroup(),h=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==l?void 0:l.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==l?void 0:l.AABBBounds.height())&&void 0!==s?s:0};if(0===h.width||0===h.height)return t;const{avoidBaseMark:c,strategy:d=[],hideOnHit:u=!0,clampForce:p=!0}=e,g=this._bmpTool||EU(h.width,h.height),f=this._bitmap||g.bitmap(),m=d.some((t=>"bound"===t.type));c&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&f.setRange(RU(g,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:HU,h=null!==(n=a.duration)&&void 0!==n?n:jU,c=null!==(s=a.easing)&&void 0!==s?s:NU,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=zU(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&an(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new PC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(zU(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==EA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===EA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=rU(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=rU(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=rU(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class WU extends VU{constructor(t){super(xn({},WU.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}WU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class UU extends VU{constructor(t){super(xn({},UU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}UU.tag="rect-label",UU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const GU={rect:UU,symbol:WU};class YU extends tU{constructor(t){super(xn({},YU.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!an(n*i))return;this._componentMap||(this._componentMap=new Map);const s=EU(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function $U(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function XU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=ks.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function KU(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=$U(t,!!s),o=$U(r,!!s);const h=ks.distancePP(n,l),c=ks.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=XU(e,t,!1,!!s),o=XU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=$U(t,!!s),o=$U(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}YU.defaultAttributes={pickable:!1};class qU extends tU{constructor(t){super(xn({},qU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!un(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let l="";if("line"===t||"polygon"===t)l=$U(o,!!n);else if("circle"===t){const{center:t}=this.attribute;l=XU(t,o,!1,!!n)}const h=dB(Object.assign({path:l,z:r},$i(i)?xn({},qU.defaultAttributes.style,i(e,s)):i));h.name=`${this.name}-line`,h.id=this._getNodeId(`path-${a}`),this.add(h)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const l=a[1].x-a[0].x,h=a[1].y-a[0].y,c=Math.sqrt(l*l+h*h),d=r/c;o.push({x:a[0].x+l*d,y:a[0].y+h*d});const u=$U(o,!!n),p=us(o[0].x-o[1].x),g=us(o[0].y-o[1].y),f=dB(Object.assign({path:u,z:0,alpha:p>g?(a[1].x-a[0].x>0?-1:1)*ls/2:0,beta:pg?[o[0].x,0]:[0,o[0].y]},$i(i)?xn({},qU.defaultAttributes.style,i(t,e)):i));f.name=`${this.name}-line`,f.id=this._getNodeId(`path-${s}`),this.add(f)})),e.length>1&&s)){const t=en(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0:i.size)||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};l=[...l.slice(0,l.length-1),n]}const h=cB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),un(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=fB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),un(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var JU,QU;ZU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(JU||(JU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(QU||(QU={}));const tG={[QU.selectedReverse]:{},[QU.selected]:{},[QU.hover]:{},[QU.hoverReverse]:{}},eG={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var iG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!un(e.states)&&(e.addState(fU.hover,!0),iU(this.axisContainer,(t=>{t!==e&&t.name&&!un(t.states)&&t.addState(fU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(iU(this.axisContainer,(t=>{t.name&&!un(t.states)&&(t.removeState(fU.hoverReverse),t.removeState(fU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(fU.selected))return this._lastSelect=null,void iU(this.axisContainer,(t=>{t.name&&!un(t.states)&&(t.removeState(fU.selectedReverse),t.removeState(fU.selected))}));e.name&&!un(e.states)&&(e.addState(fU.selected,!0),iU(this.axisContainer,(t=>{t!==e&&t.name&&!un(t.states)&&t.addState(fU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=yn(this.attribute);xn(this.attribute,t);const i=hB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=hB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,grid:r,items:a,panel:o}=this.attribute,l=hB({x:0,y:0,zIndex:1});if(l.name=JU.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=hB({x:0,y:0,pickable:!1});t.name=JU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=uB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=JU.background,e.id=this._getNodeId("background"),un(o.state)||(e.states=xn({},mU,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){var e;const i=this.getTickLineItems(),n=hB({x:0,y:0,pickable:!1});n.name=JU.tickContainer,n.id=this._getNodeId("tick-container"),t.add(n);const s=un(null===(e=this.attribute.tick)||void 0===e?void 0:e.state)?null:xn({},mU,this.attribute.tick.state);i.forEach(((t,e)=>{const r=cB(Object.assign({},this._getTickLineAttribute("tick",t,e,i)));r.name=JU.tick,r.id=this._getNodeId(t.id),r.states=s,n.add(r)})),this.tickLineItems=i;const{subTick:r}=this.attribute;if(null==r?void 0:r.visible){const t=this.getSubTickLineItems();if(t.length){const e=un(r.state)?null:xn({},mU,r.state);t.forEach(((t,s)=>{const r=cB(Object.assign({},this._getTickLineAttribute("subTick",t,s,i)));r.name=JU.subTick,r.id=this._getNodeId(`${s}`),r.states=e,n.add(r)}))}this.subTickLineItems=t}}renderLabels(t,e,i){var n;const{dataFilter:s}=this.attribute.label;s&&$i(s)&&(e=s(e,i));const r=this._transformItems(e),a=hB({x:0,y:0,pickable:!1});a.name=`${JU.labelContainer}-layer-${i}`,a.id=this._getNodeId(`label-container-layer-${i}`),t.add(a);let o=0,l=0,h="center",c="middle";const d=un(null===(n=this.attribute.label)||void 0===n?void 0:n.state)?null:xn({},mU,this.attribute.label.state);return r.forEach(((t,e)=>{var n;const s=this._getLabelAttribute(t,e,r,i),u=gB(s);u.name=JU.label,u.id=this._getNodeId(`layer${i}-label-${t.id}`),u.states=d,a.add(u);const p=null!==(n=s.angle)&&void 0!==n?n:0;o=Math.max(o,u.AABBBounds.width()),l=Math.max(l,u.AABBBounds.height()),p&&(o=Math.abs(o*Math.cos(p)),l=Math.abs(l*Math.sin(p))),h=s.textAlign,c=s.textBaseline})),this.axisLabelLayerSize[i]={width:o,height:l,textAlign:h,textBaseline:c},a}renderTitle(t){const e=this.getTitleAttribute(),i=new bU(Object.assign({},e));i.name=JU.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return Un(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&$i(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;us(n[0])>us(n[1])?o=ls/2*(l.x>e.x?1:-1):h=ls/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===y[1]?f+=(this.axisLabelLayerSize[n-1].height+pn(this.attribute,"label.space",4))*n:f+=(this.axisLabelLayerSize[n-1].width+pn(this.attribute,"label.space",4))*n);const _=this.getVerticalCoord(t.point,f,u),v=this.getVerticalVector(f,u,_),b=p?p(t.label,t,e,i,n):t.label;let{style:x}=g;return x=$i(x)?xn({},eG.label.style,x(t,e,i,n)):x,x=xn({textAlign:this.getTextAlign(v),textBaseline:this.getTextBaseline(v,u)},x),$i(x.text)&&(x.text=x.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},_),{text:b,lineHeight:null==x?void 0:x.fontSize}),x)}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new qU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${JU.grid}-sub`:`${JU.grid}`,n.id=this._getNodeId(t),e.add(n)}}const sG={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&rG(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function rG(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function aG(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function lG(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=dr(t,i),r=dr(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=cr(t),l=cr(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:hr(t.angle);let f=i?t.angle+hs:hr(90-t.angle);const m=i?e.angle:hr(e.angle);let y=i?e.angle+hs:hr(90-e.angle);f>ds&&(f-=ds),y>ds&&(y-=ds);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(or(s,i)+or(s,n))/2>or(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function hG(t,e){"bottom"!==t&&"top"!==t||function(t,e){let i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var cG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return cU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:h="middle",space:c=4,textStyle:d={},autoRotate:u=!0,shape:p,background:g,state:f}=l,m=cG(l,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===h?y=0:"end"===h&&(y=1);const{verticalFactor:_=1}=this.attribute,v=-1*_,b=this.getTickCoord(y),x=this.getRelativeVector();let S=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+pn(this.attribute,"label.space",4);S+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===x[1])S+=this.axisLabelsContainer.AABBBounds.height()+(e-1)*t;else if(0===x[0])S+=this.axisLabelsContainer.AABBBounds.width()+(e-1)*t;else{Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{S+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const e=this.axisLabelLayerSize[0].textAlign,i="start"===e||"left"===e,n="center"===e,s=x[1]>0;S=1===v?s?i?S:n?S/2:0:i?t:n?S/2:S:s?i?0:n?S/2:S:i?S:n?S/2:0}}let w=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(w=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(w=Math.max(w,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const A=w+S+c,k=this.getVerticalCoord(b,A,!1),M=this.getVerticalVector(A,!1);let C,T,{angle:E}=m;if(C="start"===h?"start":"end"===h?"end":"center",Xi(E)&&u){E=dU(x,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else C=this.getTextAlign(M),T=this.getTextBaseline(M,!1);const R=Object.assign(Object.assign(Object.assign({},k),m),{textStyle:Object.assign({textAlign:C,textBaseline:T},d),state:un(f)?null:{text:f.text,shape:f.shape,panel:f.background}});return R.angle=E,p&&p.visible&&(R.shape=Object.assign({visible:!0},p.style),p.space&&(R.space=p.space)),g&&g.visible&&(R.panel=Object.assign({visible:!0},g.style)),R}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=uU,endAngle:r=pU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}else{n=xn({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(un(t))return;const{verticalLimitSize:o,label:l,title:h,line:c,tick:d,orient:u}=this.attribute,p=null!==(s=l.space)&&void 0!==s?s:4;let g=o,f=0,m=0;const y=(null==c?void 0:c.visible)?null!==(r=c.style.lineWidth)&&void 0!==r?r:1:0,_=(null==d?void 0:d.visible)?null!==(a=d.length)&&void 0!==a?a:4:0;(null==h?void 0:h.visible)&&(f=_U(h.text,h.textStyle).height,m=h.space),g&&(g=(g-p-m-f-y-_)/n);const{layoutFunc:v,autoRotate:b,autoRotateAngle:x,autoLimit:S,limitEllipsis:w,autoHide:A,autoHideMethod:k,autoHideSeparation:M}=l;$i(v)?v(t,e,i,this):(b&&function(t,e){if(un(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Es(e)})),hG(i,t),!lG(t))break}}(t,{labelRotateAngle:x,orient:u}),S&&an(g)&&g>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!un(t)&&an(i)&&t.forEach((t=>{const e=0===t.attribute.angle||Xi(t.attribute.angle)?"top"===s||"bottom"===s?null:i:i/Math.sin(t.attribute.angle);t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:g,ellipsis:w,orient:u}),A&&function(t,e){if(un(t))return;const i=t.filter(oG);if(un(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=$i(s)?s:sG[s]||sG.parity;if(n.length>=3&&aG(n,r)){do{n=a(n,r)}while(n.length>=3&&aG(n,r));n.length<3&&!Tn(i).attribute.opacity&&(n.length>1&&Tn(n).setAttribute("opacity",0),Tn(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:u,method:k,separation:M}))}}dG.defaultAttributes=eG;var uG,pG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=lB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=JU.line,c.id=this._getNodeId("line"),un(null==a?void 0:a.state)||(c.states=xn({},tG,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=uU,endAngle:i=pU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=uU,endAngle:i=pU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Is(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return cU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:h,innerRadius:c=0}=this.attribute,d=this.attribute.title,{space:u=4,textStyle:p={},shape:g,background:f,state:m}=d,y=pG(d,["space","textStyle","shape","background","state"]);let _=l,v=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(v=pn(this.attribute.label,"style.fontSize",12)+pn(this.attribute.label,"space",4));let b=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(b=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(b=Math.max(b,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const x=h+b+v+u;let S="middle",{position:w}=this.attribute.title;Xi(w)&&(w=0===c?"end":"middle"),"start"===w?(S="bottom",_={x:l.x,y:l.y-x}):"end"===w&&(S="top",_={x:l.x,y:l.y+x});const A=Object.assign(Object.assign(Object.assign({},_),y),{textStyle:Object.assign({textBaseline:S,textAlign:"center"},p),state:un(m)?null:{text:m.text,shape:m.shape,panel:m.background}}),{angle:k}=y;return A.angle=k,g&&g.visible&&(A.shape=Object.assign({visible:!0},g.style),g.space&&(A.space=g.space)),f&&f.visible&&(A.panel=Object.assign({visible:!0},f.style)),A}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=xn({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}gG.defaultAttributes=eG;class fG extends dC{constructor(){super(...arguments),this.mode=PA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return iU(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},iU(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!An(t.attribute,o.attribute)){const s=yn(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=an(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=ns.lastIndex=ss.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=ns.exec(t))&&(n=ss.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:es(i,n)})),r=ss.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=uG.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=uG.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=uG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=uG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=uG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===uG.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===uG.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=uG.endHandler):this.state.start=this.state.start+o:this._activeTag===uG.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===yj.env&&(yj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),yj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===uG.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:Kn(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===uG.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:Kn(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===uG.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=yG(t,["formatMethod"]),{formatMethod:s}=e,r=yG(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,xn({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,xn({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,xn({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,xn({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:i,size:n,orient:s,middleHandlerStyle:r}=this.attribute,{width:a,height:o}=n,l=null!==(e=null===(t=null==r?void 0:r.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let h,c,d;return(null==r?void 0:r.visible)?this._isHorizontal?(h=a,c=o-l,d={x:i.x,y:i.y+l}):(h=a-l,c=o,d={x:i.x+("left"===s?l:0),y:i.y}):(h=a,c=o,d=i),this._layoutAttrFromConfig={position:d,width:h,height:c},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:R,end:P}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+R*I,y:B.y,width:(P-R)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+R*D,width:I,height:(P-R)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+R*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(P-R)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(R+P)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+R*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(P-R)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(R+P)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{position:i,size:n,selectedBackgroundChartStyle:s}=this.attribute,{width:r,height:a}=n,{start:o,end:l}=this.state;this.computeBasePoints(),this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?i.x+o*r:i.x,y:this._isHorizontal?i.y:i.y+o*a,width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?i.x+o*r:i.x),y:-(this._isHorizontal?i.y:i.y+o*a),width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==s?void 0:s.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==s?void 0:s.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new bU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;Ki(t)&&Ki(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...Cn(a))}setUpdateStateCallback(t){$i(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){$i(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){$i(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){$i(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){$i(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){$i(t)&&(this._statePointToData=t)}};var vG,bG,xG;_G.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!1,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(vG||(vG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(bG||(bG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xG||(xG={}));class SG extends tU{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=hB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const wG={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:vG.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},AG={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},kG={label:{position:bG.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},MG={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},CG={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};let TG=class t extends SG{constructor(e){super(xn({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},AG[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new ZU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new bU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};TG.defaultAttributes=wG;let EG=class t extends SG{constructor(e){super(xn({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},MG[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=yB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new bU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};EG.defaultAttributes=kG;let RG=class t extends SG{constructor(e){super(xn({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=xG.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},CG[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=fB(Object.assign(Object.assign({},e),n)):"text"===i?o=new bU(Object.assign({},e)):"richText"===i?o=_B(Object.assign(Object.assign({},e),s)):"image"===i?o=mB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new ZU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=cB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};RG.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const PG={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class BG extends tU{getCurrent(){return this._current}constructor(t){super(xn({},BG.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new XM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new XM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(zG.item)){const t=i.delegate;t.hasState(OG.selected)?this._setLegendItemState(t,OG.selectedHover):this._setLegendItemState(t,OG.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===zG.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(FG.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(zG.item)){const t=i.delegate;t.removeState(OG.unSelectedHover),t.removeState(OG.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(OG.unSelectedHover),t.removeState(OG.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===zG.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(FG.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(zG.item)){const t=a.delegate;if(a.name===zG.focus){const e=t.hasState(OG.focus);t.toggleState(OG.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover,OG.focus]),this._setLegendItemState(t,OG.selected)})):(this._setLegendItemState(t,OG.selected),this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[OG.selected,OG.selectedHover,OG.focus]),this._setLegendItemState(e,OG.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(OG.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(OG.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(FG.legendItemClick,t);n?(this._removeLegendItemState(t,[OG.selected,OG.selectedHover]),this._setLegendItemState(t,OG.unSelected)):(this._setLegendItemState(t,OG.selected),this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover]))}else this._setLegendItemState(t,OG.selected),this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[OG.selected,OG.selectedHover]),this._setLegendItemState(e,OG.unSelected))}))}this._dispatchEvent(FG.legendItemClick,t)}}}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,OG.selected),this._removeLegendItemState(e,[OG.unSelected,OG.unSelectedHover])):(this._removeLegendItemState(e,[OG.selected,OG.selectedHover]),this._setLegendItemState(e,OG.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||un(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=hB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:c=[],autoPage:d}=this.attribute,u="horizontal"===o,{spaceCol:p=IG,spaceRow:g=DG,maxWidth:f,width:m,height:y}=t;Ki(f)?Ki(m)?this._itemWidthByUser=Math.min(f,m):this._itemWidthByUser=f:Ki(m)&&(this._itemWidthByUser=m),Ki(y)&&(this._itemHeightByUser=y);let _=!1,v=0,b=0,x=0,S=1,w=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!un(c)||(null==c?void 0:c.includes(t.label)),e),r=i.attribute.width,o=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,o),v=Math.max(r,v),this._itemMaxWidth=Math.max(r,this._itemMaxWidth),u?(S=s,Ki(l)&&(r>=l?(_=!0,e>0&&(b=0,x+=o+g,w+=1)):l0&&i.setAttributes({x:b,y:x}),b+=p+r):(S=n,Ki(h)&&h0&&i.setAttributes({x:b,y:x}),x+=g+o),a.add(i)}));let A=!1;_&&d&&w>S&&(A=this._renderPager(u)),A||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+pn(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i){const{id:n,label:s,value:r,shape:a}=t,{shape:o={},label:l={},value:h={},padding:c=0,background:d,focus:u,focusIconStyle:p={}}=this.attribute.item,g=Tr(c);let f;!1===d.visible?(f=hB({x:0,y:0,cursor:null==d?void 0:d.style.cursor}),this._appendDataToShape(f,zG.item,t,f)):(f=hB(Object.assign({x:0,y:0},null==d?void 0:d.style)),this._appendDataToShape(f,zG.item,t,f,null==d?void 0:d.state)),f.addState(e?OG.selected:OG.unSelected);const m=hB({x:0,y:0,pickable:!1});f.add(m);let y=0;const _=pn(o,"style.size",10),v=pn(o,"space",8),b=fB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},a),o.style));let x;Object.keys(o.state||{}).forEach((t=>{const e=o.state[t].fill||o.state[t].stroke;a.fill&&Xi(o.state[t].fill)&&e&&(o.state[t].fill=e),a.stroke&&Xi(o.state[t].stroke)&&e&&(o.state[t].stroke=e)})),this._appendDataToShape(b,zG.itemShape,t,f,null==o?void 0:o.state),b.addState(e?OG.selected:OG.unSelected),m.add(b);let S=0;if(u){const e=pn(p,"size",10);x=fB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},p),{visible:!1,pickMode:"imprecise",boundsPadding:g})),this._appendDataToShape(x,zG.focus,t,f),S=e}const w=gB(Object.assign(Object.assign({x:_/2+v,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==l?void 0:l.style.fontSize},null==l?void 0:l.style),{text:l.formatMethod?l.formatMethod(s,t,i):s}));this._appendDataToShape(w,zG.itemLabel,t,f,null==l?void 0:l.state),w.addState(e?OG.selected:OG.unSelected),m.add(w);const A=pn(l,"space",8);if(y+=_/2+v+w.AABBBounds.width()+A,Ki(r)){const n=pn(h,"space",u?8:0),s=gB(Object.assign(Object.assign({x:y+A,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==h?void 0:h.style.fontSize},null==h?void 0:h.style),{text:h.formatMethod?h.formatMethod(r,t,i):r}));this._appendDataToShape(s,zG.itemValue,t,f,null==h?void 0:h.state),s.addState(e?OG.selected:OG.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-g[1]-g[3]-_-v-w.AABBBounds.width()-A-S-n),h.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-_/2-g[1]-g[3]-S-n})),y=s.AABBBounds.x2+n,m.add(s)}else this._itemWidthByUser&&w.setAttribute("maxLineWidth",this._itemWidthByUser-g[1]-g[3]-_-v-S);x&&(x.setAttribute("x",y),m.add(x));const k=m.AABBBounds,M=k.width(),C=k.height(),T=this._itemWidthByUser||M+g[1]+g[3],E=this._itemHeightByUser||C+g[0]+g[2];return f.attribute.width=T,f.attribute.height=E,m.translateTo(-k.x1+g[3],-k.y1+g[0]),f}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+pn(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=IG,spaceRow:h=DG}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=LG}=o,f=jG(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new BG(Object.assign({layout:1===r?"horizontal":"vertical",total:99},xn({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new BG(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=hB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==zG.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==zG.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(OG.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=xn({},NG,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new XM(t,{item:e,data:e.data,selected:e.hasState(OG.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}};var WG;function UG(t){return en(t)?t:[t,t]}function GG(t){return t?"ew-resize":"ns-resize"}VG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:IG,spaceRow:DG,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:LG,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(WG||(WG={}));let YG=class t extends tU{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(xn({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===yj.env?(yj.addEventListener("pointermove",this._onHandlerPointerMove),yj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=Kn(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===yj.env)yj.removeEventListener("pointermove",this._onHandlerPointerMove),yj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===yj.env?(yj.addEventListener("pointermove",this._onTrackPointerMove),yj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=Kn(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=Kn(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===yj.env?(yj.removeEventListener("pointermove",this._onTrackPointerMove),yj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,c;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x,c=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,c=i);const d=o/c*(s-n)+n;if(Ki(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,d)}else this._updateHandler(r,o,d);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=Cn(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:h=!0}=this.attribute;let{value:c}=this.attribute;Xi(c)&&(c=[o,l]),this._currentValue={startValue:UG(c)[0],endValue:UG(c)[1]};const d="horizontal"===i;this._isHorizontal=d;const u=hB({x:0,y:0});u.name=WG.innerView,this.add(u),this._innerView=u;let p,g=0;if(r&&r.visible){p=gB(Object.assign({x:d?0:n/2,y:d?s/2:0,textAlign:d?"start":"center",textBaseline:d?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),p.name=WG.startText,u.add(p);const e=Ki(r.space)?r.space:0;g+=(d?p.AABBBounds.width():p.AABBBounds.height())+e}const f=hB({x:d?g:0,y:d?0:g});u.add(f);const m=hB({x:0,y:0});let y;if(m.name=WG.railContainer,this._railContainer=m,f.add(m),this._renderRail(m),g+=d?n:s,a&&a.visible){const t=Ki(a.space)?a.space:0;y=gB(Object.assign({x:d?g+t:n/2,y:d?s/2:g+t,textAlign:d?"start":"center",textBaseline:d?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),y.name=WG.endText,u.add(y)}this._renderTrack(m),h&&(this._renderHandlers(f),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=uB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=WG.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;Xi(c)&&(c=[i,n]);const d=a&&a.visible,u=this._isHorizontal,p=u?l:o,[g,f]=UG(c),m=(g-i)/(n-i)*p,y=this._renderHandler(Object.assign({x:u?m:l/2,y:u?o/2:m,size:s,strokeBoundsBuffer:0,cursor:!1===h?"default":GG(u)},r));if(y.name=WG.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,d){const e=this._renderHandlerText(g);e.name=WG.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(f-i)/(n-i)*p,a=this._renderHandler(Object.assign({x:u?e:l/2,y:u?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===h?"default":GG(u)},r));if(a.name=WG.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f);e.name=WG.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:h}=this.attribute;Xi(h)&&(h=[i,n]);const c=this._isHorizontal,d=c?r:s;let[u,p]=UG(h);e||(u=i);const g=hB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});g.name=WG.trackContainer;const f=qi(e)&&!0===e.draggableTrack;let m;m=!1===l?"default":!1===e||!1===f?"pointer":GG(c);const y=(p-u)/(n-i)*d,_=uB(Object.assign({x:c?(u-i)/(n-i)*d:0,y:c?0:(u-i)/(n-i)*d,width:c?y:r,height:c?s:y,cursor:m},a));_.name=WG.track,this._track=_,g.add(_),t.add(g)}_renderHandler(t){return fB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":GG(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),gB(f)}_bindEvents(){const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),qi(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===WG.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===WG.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===WG.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===WG.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new XM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};YG.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class $G extends HG{constructor(t){super(xn({},$G.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function XG(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}$G.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class KG extends HG{constructor(t){super(xn({},KG.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y,sizeBackground:_}=this.attribute,v=hB({x:0,y:0});this._innerView.add(v);const b=new YG({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:XG(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=dB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+pn(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}KG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};let qG=class t extends tU{constructor(e){super(xn({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,R,P,B,I,D,L,O,F,z,H,j,N,V,W,U,G,Y,$,X,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot;const{text:lt,textStyle:ht,subtext:ct,subtextStyle:dt,width:ut,height:pt,minWidth:gt,maxWidth:ft,minHeight:mt,maxHeight:yt,align:_t,verticalAlign:vt,padding:bt=0}=this.attribute,xt=Tr(bt),St=this.createOrUpdateChild("title-container",{x:xt[3],y:xt[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ht?void 0:ht.visible))if(ht&&Ki(null==ht?void 0:ht.character)){const t={x:null!==(e=ht.x)&&void 0!==e?e:0,y:null!==(i=ht.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ht.width)&&void 0!==n?n:ut)&&void 0!==s?s:0,height:null!==(a=null!==(r=ht.height)&&void 0!==r?r:pt)&&void 0!==a?a:0,ellipsis:null===(o=ht.ellipsis)||void 0===o||o,wordBreak:null!==(l=ht.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ht.maxHeight,maxWidth:ht.maxWidth,textConfig:ht.character};this._mainTitle=St.createOrUpdateChild("mainTitle",t,"richtext")}else Ki(lt)&&(this._mainTitle=St.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[lt]},ht),{maxLineWidth:null!==(h=null==ht?void 0:ht.maxLineWidth)&&void 0!==h?h:ut,heightLimit:null==ht?void 0:ht.heightLimit,lineClamp:null==ht?void 0:ht.lineClamp,ellipsis:null===(c=null==ht?void 0:ht.ellipsis)||void 0===c||c,x:0,y:0}),"wrapText"));const wt=this._mainTitle?null===(d=this._mainTitle)||void 0===d?void 0:d.AABBBounds.height():0,At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.width():0;if(!1!==(null===(p=this.attribute)||void 0===p?void 0:p.visible)&&!1!==(null==dt?void 0:dt.visible))if(dt&&Ki(null==dt?void 0:dt.character)){const t={x:null!==(g=dt.x)&&void 0!==g?g:0,y:null!==(f=dt.y)&&void 0!==f?f:wt,width:null!==(y=null!==(m=dt.width)&&void 0!==m?m:ut)&&void 0!==y?y:0,height:null!==(v=null!==(_=dt.height)&&void 0!==_?_:pt)&&void 0!==v?v:0,ellipsis:null===(b=dt.ellipsis)||void 0===b||b,wordBreak:null!==(x=dt.wordBreak)&&void 0!==x?x:"break-word",maxHeight:dt.maxHeight,maxWidth:dt.maxWidth,textConfig:dt.character};this._subTitle=St.createOrUpdateChild("subTitle",t,"richtext")}else Ki(ct)&&(this._subTitle=St.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[ct]},dt),{maxLineWidth:null!==(S=null==dt?void 0:dt.maxLineWidth)&&void 0!==S?S:ut,heightLimit:null==dt?void 0:dt.heightLimit,lineClamp:null==dt?void 0:dt.lineClamp,ellipsis:null===(w=null==dt?void 0:dt.ellipsis)||void 0===w||w,x:0,y:wt}),"wrapText"));const kt=this._subTitle?null===(A=this._subTitle)||void 0===A?void 0:A.AABBBounds.height():0,Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.width():0;let Ct=Math.max(At,Mt),Tt=wt+(null!==(M=null==dt?void 0:dt.height)&&void 0!==M?M:kt);if(Ki(ut)&&(Ct=ut,null===(C=this._mainTitle)||void 0===C||C.setAttribute("maxLineWidth",ut),null===(T=this._subTitle)||void 0===T||T.setAttribute("maxLineWidth",ut)),Ki(pt)&&(Tt=pt),Ki(gt)&&Ctft&&(Ct=ft)),Ki(mt)&&Ttyt&&(Tt=yt)),St.attribute.width=Ct+xt[1]+xt[3],St.attribute.height=Tt+xt[0]+xt[2],Ki(_t)||Ki(null==ht?void 0:ht.align)){const t=(null==ht?void 0:ht.align)?null==ht?void 0:ht.align:_t,e=null!==(L=null==ht?void 0:ht.width)&&void 0!==L?L:At;"left"===t?(null===(O=this._mainTitle)||void 0===O||O.setAttribute("x",0),null===(F=this._mainTitle)||void 0===F||F.setAttribute("textAlign","left")):"center"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e/2),null===(H=this._mainTitle)||void 0===H||H.setAttribute("textAlign","center")):"right"===t&&(null===(j=this._mainTitle)||void 0===j||j.setAttribute("x",e),null===(N=this._mainTitle)||void 0===N||N.setAttribute("textAlign","right"))}if(Ki(vt)||Ki(null==ht?void 0:ht.verticalAlign)){const t=(null==ht?void 0:ht.verticalAlign)?null==ht?void 0:ht.verticalAlign:vt,e=(null==ht?void 0:ht.height)?null==ht?void 0:ht.height:Ct;"top"===t?(null===(V=this._mainTitle)||void 0===V||V.setAttribute("y",0),null===(W=this._mainTitle)||void 0===W||W.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(Ki(_t)||Ki(null==dt?void 0:dt.align)){const t=(null==dt?void 0:dt.align)?null==dt?void 0:dt.align:_t,e=null!==(X=null==dt?void 0:dt.width)&&void 0!==X?X:Mt;"left"===t?(null===(K=this._subTitle)||void 0===K||K.setAttribute("x",0),null===(q=this._subTitle)||void 0===q||q.setAttribute("textAlign","left")):"center"===t?(null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("x",e/2),null===(J=this._subTitle)||void 0===J||J.setAttribute("textAlign","center")):"right"===t&&(null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("x",e),null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("textAlign","right"))}if(Ki(vt)||Ki(null==ht?void 0:ht.verticalAlign)){const t=(null==dt?void 0:dt.verticalAlign)?null==dt?void 0:dt.verticalAlign:vt,e=wt,i=null!==(et=null==dt?void 0:dt.height)&&void 0!==et?et:0;"top"===t?(null===(it=this._subTitle)||void 0===it||it.setAttribute("y",e),null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("textBaseline","top")):"middle"===t?(null===(st=this._subTitle)||void 0===st||st.setAttribute("y",e+i/2),null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(at=this._subTitle)||void 0===at||at.setAttribute("y",e+i),null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("textBaseline","bottom"))}}};qG.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const ZG={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};let JG=class extends tU{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(Ki(i))if(!1!==i.visible){const t=xn({},pn(ZG,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:Ki(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&an(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&an(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(Ki(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=Cn(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=xn({},pn(ZG,"content.style"),e.style),c=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:Ki(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&an(a)&&this._setAutoFit(a,c,e),e.autoLimit&&an(r)&&c.setAttribute("maxLineWidth",a),s.push(c);const d=(null==e?void 0:e.space)?e.space:0;h+=c.AABBBounds.height()+d}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=_U(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",Ki(i.style.lineHeight)?i.style.lineHeight:s)}}};class QG extends XR{constructor(t){super(t)}}var tY,eY;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(tY||(tY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(eY||(eY={}));class iY extends tU{constructor(t){super(xn({},iY.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},iY.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},iY.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},iY.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},iY.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{Xi(this._playController)&&(this._playController=new QG(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{Xi(this._backwardController)&&(this._backwardController=new QG(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{Xi(this._forwardController)&&(this._forwardController=new QG(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()}))},this._createCustomEvent=t=>{var e;const i=new XM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{const t=this._createCustomEvent(tY.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(tY.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(tY.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(tY.OnBackward);this.dispatchEvent(t)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}iY.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},iY.defaultAttributes={visible:!0,[eY.Start]:{},[eY.Pause]:{},[eY.Backward]:{},[eY.Forward]:{}};const nY={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},sY=[200,10];var rY,aY;!function(t){t.Default="default",t.Reverse="reverse"}(rY||(rY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(aY||(aY={}));const oY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===rY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===rY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},lY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===rY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===rY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},hY=t=>"top"===t||"bottom"===t;class cY extends tU{constructor(t){super(xn({},cY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;an(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=fs(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:an(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(hY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:sY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:sY[1];s.layout="vertical",s.railWidth=e,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new YG(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return hY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new iY(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=hY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:sY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=rn(i)?i:fs(i[0],i[1]);return t+e.space+n}),0),l=(hY(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=rn(s)?s:fs(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:hY(this._orient)?t+n:(this._size.width-r)/2,y:hY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:hY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:hY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=rn(s)?s:fs(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:hY(this._orient)?t+n:(this._size.width-r)/2,y:hY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){var i;const n=new XM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}cY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},nY),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},nY),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},nY),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},nY),{key:"backward",position:"start"})}};class dY extends cY{constructor(t){super(xn({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:rY.Default,this._dataIndex=Xi(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(tY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(tY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(tY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(tY.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(aY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(oY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||lY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===rY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(aY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(aY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(aY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),yj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(aY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,yj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(aY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(aY.OnChange),this.dispatchCustomEvent(aY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(aY.OnChange),this.dispatchCustomEvent(aY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var uY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class pY extends cY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(tY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(tY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(tY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(tY.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,n=i/this._maxIndex;this._elapsed=n*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)}))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(aY.OnChange))},this.play=()=>uY(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(aY.OnPlay),this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,yj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(aY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,yj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(aY.OnPause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(aY.OnBackward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(aY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const gY={debounce:Qn,throttle:ts};let fY=class t extends tU{constructor(e){super(xn({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",gY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(vr(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:yn(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=yB(Object.assign({points:yn(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return xn(t,...i,{shape:s.every(Xi)?void 0:xn({},...s),key:r.every(Xi)?void 0:xn({},...r),value:a.every(Xi)?void 0:xn({},...a)})},yY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:Cn(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},_Y={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:gU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:gU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:gU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ts).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},vY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let bY=class t extends tU{constructor(e){super(xn({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=Tr(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const c=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",xn({symbolType:"circle"},c.shape,{visible:nU(c)&&nU(c.shape)}),"symbol"),c.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:nU(c)&&nU(c.value)},yY(c.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:nU(c)&&nU(c.value)},c.value),"text");const d=nU(c.shape)?c.shape.size+c.shape.spacing:0,{textAlign:u,textBaseline:p}=c.value,g=n.width-h[3]-h[0]-d;"center"===u?this._tooltipTitle.setAttribute("x",d+g/2):"right"===u||"end"===u?this._tooltipTitle.setAttribute("x",d+g):this._tooltipTitle.setAttribute("x",d),"bottom"===p?this._tooltipTitle.setAttribute("y",c.height):"middle"===p?this._tooltipTitle.setAttribute("y",c.height/2):this._tooltipTitle.setAttribute("y",0);const f=nU(c)?c.height+c.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+f);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!nU(l))return;const h=`tooltip-content-${n}`,c=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let d=0;if(nU(l.shape)&&c.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(d+=l.shape.size+l.shape.spacing),nU(l.key)){let t;t=l.key.multiLine?c.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},yY(l.key)),{textBaseline:"top"}),"richtext"):c.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",d+s/2):"right"===e||"end"===e?t.setAttribute("x",d+s):t.setAttribute("x",d),t.setAttribute("y",0),d+=s+l.key.spacing}if(nU(l.value)){let t;t=l.value.multiLine?c.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},yY(l.value)),{textBaseline:"top"}),"richtext"):c.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";Ki(l.value.textAlign)?e=l.value.textAlign:nU(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",d+r/2):"right"===e||"end"===e?t.setAttribute("x",d+r):t.setAttribute("x",d),d+=r,t.setAttribute("y",0),c.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>vY.includes(t)))?(this._mergeAttributes(e,n),Xi(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&nU(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=nU(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=yU(u),v=yU(p);let b=0;if(nU(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(nU(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&YR[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return mY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return mY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};bY.defaultAttributes=_Y;const xY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class SY extends JW{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=tn(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}zV(aV.lineAxis,((t,e)=>new dG(t,e))),zV(aV.circleAxis,(t=>new gG(t)));class wY extends SY{constructor(t,e,i){super(t,sV.axis,e),this.spec.componentType=sV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=xn({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=FV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=vV(s,e,i,n);const c=jN(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=jN(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=jN(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case aV.lineAxis:return((t,e,i)=>{var n,s;const r=xY.axis;return t?xn({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):xn({},r,null!=e?e:{})})(u,h,p);case aV.circleAxis:return((t,e,i)=>{var n,s;const r=xY.circleAxis;return t?xn({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):xn({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(Xi(e)){const i=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?aV.circleAxis:aV.lineAxis,this._axisComponentType}}zV(oV.discreteLegend,(t=>new VG(t))),zV(oV.colorLegend,(t=>new $G(t))),zV(oV.sizeLegend,(t=>new KG(t)));class AY extends SY{constructor(t,e){super(t,sV.legend,e),this.spec.componentType=sV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==oV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":FG.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=tn(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=tn(t)?this.view.getDataById(t):t,l=tn(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,rV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=FV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=vV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case oV.discreteLegend:return((t,e)=>{const i=xY.discreteLegend;return t?xn({},i,{items:Array.from(new Set(Cn(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=UN(n),r=s?Object.assign(Object.assign({},xY.discreteLegend.items[0].shape),{fill:s,stroke:s}):xY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):xn({},i,null!=e?e:{})})(o,a);case oV.colorLegend:return((t,e)=>{const i=xY.colorLegend;if(!t)return xn({},i,null!=e?e:{});const n=t.domain();return xn({},i,{colors:t.range().slice(),min:n[0],max:Tn(n)},null!=e?e:{})})(o,a);case oV.sizeLegend:return((t,e)=>{const i=xY.sizeLegend;if(!t)return xn({},i,null!=e?e:{});const n=t.domain();return xn({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&Nl(i)){const t=e.getScale().range();UN(null==t?void 0:t[0])?this._legendComponentType=oV.colorLegend:this._legendComponentType=oV.sizeLegend}else this._legendComponentType=oV.discreteLegend}return this._legendComponentType}}zV(lV.lineCrosshair,(t=>new SU(t))),zV(lV.rectCrosshair,(t=>new wU(t))),zV(lV.sectorCrosshair,(t=>new kU(t))),zV(lV.circleCrosshair,(t=>new AU(t))),zV(lV.polygonCrosshair,(t=>new MU(t)));const kY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(Wl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Ps(Ds(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else Nl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Ds(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class MY extends SY{constructor(t,e){super(t,sV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case lV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=xY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return xn({},l,kY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case lV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=xY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=kY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=xn({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case lV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=xY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(Wl(e.type)){const i=Ps(Ds(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else Nl(e.type)&&(f=Ds(u,t));return xn({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case lV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=xY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(Wl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else Nl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return xn({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case lV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=xY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(Wl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else Nl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return xn({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=sV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=FV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=vV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?lV.sectorCrosshair:lV.rectCrosshair:"radius"===n?lV.circleCrosshair:"radius-polygon"===n?lV.polygonCrosshair:lV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}zV(sV.slider,(t=>new YG(t)));class CY extends JW{constructor(t,e){super(t,sV.slider,e),this.spec.componentType=sV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=tn(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=tn(t)?this.view.getDataById(t):t,a=tn(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,rV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>xn({},xY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(Xi(this.spec.min)?0:jN(this.spec.min,i,t,e),Xi(this.spec.max)?1:jN(this.spec.max,i,t,e),vV(n,t,e,i))}),e}),{});this._encoders=e}}zV(sV.label,(t=>new YU(t)));let TY=class extends JW{constructor(t,e){super(t,sV.label,e),this.spec.componentType=sV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Cn(this.spec.target).map((t=>tn(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Cn(t).map((t=>tn(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=Cn(this.spec.target).map((t=>tn(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=jN(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=xY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case nV.line:r=xY.lineLabel;break;case nV.rect:r=xY.rectLabel;break;case nV.symbol:r=xY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[SV],n=vV(i,e.getDatum(),e,s),o=xn({},r.data[0],n);a.push(o)}}));const o=jN(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return xn({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!Xi(t)));return xn({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};zV(sV.datazoom,(t=>new _G(t)));class EY extends JW{constructor(t,e){super(t,sV.datazoom,e),this.spec.componentType=sV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!Xi(this.spec.preview)){const t=this.spec.preview.data,e=tn(t)?this.view.getDataById(t):t;this.detach(e),this.detach($N(this.spec.preview.x,this.view)),this.detach($N(this.spec.preview.y,this.view)),this.detach($N(this.spec.preview.x1,this.view)),this.detach($N(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=tn(t)?this.view.getDataById(t):t;this.attach(r),this.attach($N(e,this.view)),this.attach($N(i,this.view)),this.attach($N(n,this.view)),this.attach($N(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=tn(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=tn(t)?this.view.getDataById(t):t,h=tn(e)?(t,i)=>{if(Xi(i.start)||Xi(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,rV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),h),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},xY.datazoom,t),n=FV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=tn(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=vV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=xY.datazoom;return t?xn({},l,{previewData:t,previewXCallback:e?t=>vV({x:e},t,r,a).x:null,previewYCallback:i?t=>vV({y:i},t,r,a).y:null,previewX1Callback:n?t=>vV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>vV({y1:s},t,r,a).y1:null},null!=o?o:{}):xn({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=tn(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}zV(cV.continuousPlayer,(t=>new pY(t))),zV(cV.discretePlayer,(t=>new dY(t)));let RY=class extends JW{constructor(t,e){super(t,sV.player,e),this.spec.componentType=sV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=en(t)?null:tn(t)?this.view.getDataById(t):t;this.detach(e)}const r=en(e)?null:tn(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=tn(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(aY.OnChange,this._filterCallback),this.spec.target=void 0;const l=tn(t)?this.view.getDataById(t):t;return this._filterData(o,l,rV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(aY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=xn({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:FV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=vV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=en(o)?null:tn(o)?this.view.getDataById(o):o,h=en(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>xn({},xY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>xn({},xY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};zV(sV.tooltip,(t=>new bY(t)));let PY=class extends JW{constructor(t,e){super(t,sV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ts(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Ts).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>xn({},xY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=sV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=Cn(this.spec.target).map((t=>tn(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=Cn(t).map((t=>tn(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!Xi(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=vV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return Cn(t).reduce(((t,e)=>(t=t.concat(zN(e.visible,this.view)),YN(e.key)||(t=t.concat(zN(e.key,this.view))),YN(e.value)||(t=t.concat(zN(e.value,this.view))),YN(e.symbol)||(t=t.concat(zN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=jN(t.visible,n,e,i);return o=!!Xi(o)||!!o,s=YN(t.key)?dl(t.key.field)(e):jN(t.key,n,e,i),s=Xi(s)?void 0:Zi(s)?s:{text:s},r=YN(t.value)?dl(t.value.field)(e):jN(t.value,n,e,i),r=Xi(r)?void 0:Zi(r)?r:{text:r},a=YN(t.symbol)?dl(t.symbol.field)(e):jN(t.symbol,n,e,i),a=Xi(a)?void 0:Zi(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?Cn(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var BY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class IY extends RW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],Xi(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=zN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];Cn(t.source).forEach((t=>{const i=VN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return BY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return Xi(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return Xi(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Cn(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=IW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=IW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Cn(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=Cn(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function DY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function LY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,DY(t,e,s,n)}class OY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return DY(this.nodes,e,0,this.compare),LY(this.nodes,e,null,this.compare)}return this.nodes.push(t),DY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),DY(this.nodes,e,0,this.compare),LY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,LY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class FY{constructor(t){this.list=[],this.ids={},this.idFunc=t||ul}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var zY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class HY{constructor(){this.grammars=[],this.logger=ll(),this._curRank=0,this._committed=new FY((t=>t.uid)),this._heap=new OY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return zY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>Xi(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new FY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return zY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const jY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===nV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class NY{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(uV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return DT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{$k.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(uV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Rj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(uV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(uV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(uV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new eC(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=qi(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new sC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class VY extends RW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?jN(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(en(t)&&en(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function JY(t,e,i){jN(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=jN(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),Xi(null==n?void 0:n.clamp)||($i(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function QY(t,e,i){KY(t,e,i),qY(t,e,i),ZY(t,e,i),JY(t,e,i)}function t$(t,e,i){t.round&&e.round(jN(t.round,i,e),!0),t.padding&&e.padding(jN(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(jN(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(jN(t.paddingOuter,i,e),!0),t.align&&e.align(jN(t.align,i,e),!0)}function e$(t,e,i,n){const s=t.field,r=NN(t.data,i),a=tn(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),Nl(e.type)?(n&&a.filter((t=>rn(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function i$(t,e,i){if(UY(t.domain)?e.domain(e$(t.domain,e,i,!0),!0):e.domain(jN(t.domain,i,e),!0),UY(t.range))e.range(e$(t.range,e,i),!0);else if(GY(t.range)){const n=NN(t.range.coordinate,i);!function(t){switch(t){case jl.Quantile:case jl.Quantize:case jl.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(jN(t.range,i,e),!0);switch(t.type){case"linear":QY(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){t$(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){QY(t,e,i);const n=jN(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){KY(t,e,i),ZY(t,e,i),JY(t,e,i);const n=jN(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){QY(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){QY(t,e,i);const n=jN(t.constant,i,e);an(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){KY(t,e,i),ZY(t,e,i),JY(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){KY(t,e,i),qY(t,e,i),ZY(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class n$ extends RW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=WY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=WY(this.spec.type)),i$(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return Xi(this.spec.domain)||this.detach($Y(this.spec.domain,this.view)),this.spec.domain=t,this.attach($Y(t,this.view)),this.commit(),this}range(t){return Xi(this.spec.range)||this.detach($Y(this.spec.range,this.view)),this.spec.range=t,this.attach($Y(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!Xi(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!Xi(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return Xi(e)?null:this.parameters()[e]}configure(t){return this.detach(XY(this.spec.type,t,this.view)),Xi(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(XY(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let s$=-1;const r$=[VW,WW,YW,UW,GW,$W,XW],a$=t=>{var e,i,n,s;return rn(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},o$=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:DV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:PV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:RV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:IV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},l$=(t,e)=>(null==e?void 0:e.debounce)?Qn(t,e.debounce):(null==e?void 0:e.throttle)?ts(t,e.throttle):t,h$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:HW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):NV[t]?(i.markType=t,i.source=e):i.source=t===zW?zW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},c$={},d$=()=>c$;let u$=class extends ZW{constructor(t,e){super(t,nV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return gV.rect}evaluateJoin(t){return super.evaluateJoin(MV)}};function p$(t,e){if(an(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return an(t)?t*e:0}return 0}function g$(t,e){return Math.min(t<0?t+e:t-1,e)}function f$(t,e,i){let n=g$(t,i),s=g$(e,i);if(an(t)||an(e)?an(t)?an(e)||(n=g$(Math.max(0,s-1),i)):s=g$(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const m$=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>p$(t,i))),u=l.map((t=>p$(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=f$(e,i,r),{start:h,end:c}=f$(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Cs).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},y$=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=vl(r.maxChildWidth,s.width()),o=vl(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=a$(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==nV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if($i(r))r.call(null,t,s,a,e);else if($i(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=y$(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(UW,o),i.updateSignal(GW,l),i.updateSignal(YW,h)}else y$(t,s,a,e);else"grid"===r.display&&m$(t,s,a);_$(s,e,i)}))};class v$ extends ZW{constructor(t,e,i){super(t,nV.glyph,i),this.glyphType=e,this.glyphMeta=qN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=WV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let b$=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return Xi(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return Xi(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return en(t)?(i.x=t[0],i.y=t[1]):rn(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new Ls,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class x$ extends b${constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(an(t.x1)||an(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(an(t.x1)||an(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=Xi(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=Xi(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=en(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class S$ extends b${constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Ps(s);const r=Un(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function w$(t){switch(t){case"cartesian":default:return new x$;case"polar":return new S$}}class A$ extends RW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=w$(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=w$(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,h;!Xi(t.start)&&e.start(null!==(n=jN(t.start,i))&&void 0!==n?n:[0,0]),!Xi(t.end)&&e.end(null!==(s=jN(t.end,i))&&void 0!==s?s:[0,0]),!Xi(t.origin)&&e.origin(null!==(r=jN(t.origin,i))&&void 0!==r?r:[0,0]);const c=[];if(!Xi(t.translate)){const e=jN(t.translate,i);c.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!Xi(t.rotate)){const e=jN(t.rotate,i);c.push({type:"rotate",angle:null!=e?e:0})}if(!Xi(t.scale)){const e=jN(t.scale,i);c.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(h=null==e?void 0:e[1])&&void 0!==h?h:1}})}Xi(t.transpose)||jN(t.transpose,i)&&c.push({type:"transpose"}),e.applyTransforms(c)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const k$=Symbol.for("key");class M${diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new pW(t,i);return s.setCallback(((t,e,i)=>{Xi(e)?n.exit.push({prev:i[0]}):Xi(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(uW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==nV.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==nV.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=uW(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=uW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!Xi(e.morphElementKey)){const i=WN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new pW(t,i);return s.setCallback(((t,e,i)=>{Xi(e)?n.exit.push({prev:i}):Xi(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(uW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:k$})),r=uW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:k$}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==k$){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=jN(i.animation.delay,s,o,l),d=jN(i.animation.duration,s,o,l),u=jN(i.animation.oneByOne,s,o,l),p=jN(i.animation.splitPath,s,o,l),g=an(u)&&u>0?t=>rn(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?AT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:kT)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);bT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?AT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:kT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>mT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>_T(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:EA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new vT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:_C,null!==(l=i.easing)&&void 0!==l?l:vC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:EA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new xT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:_C,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:vC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):bT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class C${constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=tn(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),Xi(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),Xi(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),Xi(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),Xi(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class T${constructor(t){this.view=t}stop(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.stop()})),this}pause(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.pause()})),this}resume(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.resume()})),this}enable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.enable()})),this}disable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.disable()})),this}enableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.enableAnimationState(t)})),this}disableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.disableAnimationState(t)})),this}animate(){return this.view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){}}class E$ extends ZW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=HN(e)?null:Object.keys(e).reduce(((t,n)=>(GN(e[n])&&(t[n]=NN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=vV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===jl.Band){if(!Xi(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===jl.Band){if(!Xi(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:gV.rect}addGraphicItem(t,e){const i=VV(this,this.coord&&"polar"===this.coord.output().type?nV.arc:nV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class R$ extends ZW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=HN(e)?null:Object.keys(e).reduce(((t,n)=>(GN(e[n])&&(t[n]=NN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=vV(e,t,i,s);if(Xi(r.size)){const t=n.x?bV(n.x):void 0,e=n.y?bV(n.y):void 0;Xi(t)&&Xi(e)?r.size=10:Xi(t)?r.size=e:Xi(e)&&(r.size=t),r.size=[t,e]}return Xi(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(rn(i.padding)&&i.padding>0)t.size=en(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(en(i.padding)&&2===i.padding.length){const e=en(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(gV.symbol)}release(){super.release(),this._encoders=null}}var P$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class B$ extends Ui{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=Qn((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[SV],s=KW(0,t,n,e,HW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){tn(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new VY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new IY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new n$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new A$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=tn(e)?this.getMarkById(e):e;let s;switch(t){case nV.group:s=new u$(this,n);break;case nV.glyph:s=new v$(this,null==i?void 0:i.glyphType,n);break;case nV.component:s=((t,e,i,n)=>{switch(e){case sV.axis:return new wY(t,i,n);case sV.legend:return new AY(t,i);case sV.crosshair:return new MY(t,i);case sV.slider:return new CY(t,i);case sV.label:return new TY(t,i);case sV.datazoom:return new EY(t,i);case sV.player:return new RY(t,i);case sV.tooltip:return new PY(t,i)}return new JW(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case nV.interval:s=new E$(this,t,n);break;case nV.cell:s=new R$(this,t,n);break;default:s=new ZW(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(nV.group,t)}glyph(t,e){return this.mark(nV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(nV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(nV.component,t,{componentType:sV.axis,mode:e})}legend(t){return this.mark(nV.component,t,{componentType:sV.legend})}crosshair(t){return this.mark(nV.component,t,{componentType:sV.crosshair})}slider(t){return this.mark(nV.component,t,{componentType:sV.slider})}label(t){return this.mark(nV.component,t,{componentType:sV.label})}datazoom(t){return this.mark(nV.component,t,{componentType:sV.datazoom})}player(t){return this.mark(nV.component,t,{componentType:sV.player})}tooltip(t){return this.mark(nV.component,t,{componentType:sV.tooltip})}customized(t,e){const i=(t=>c$[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=tn(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&r$.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(uV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++s$;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(VW,t.width),this.updateSignal(WW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=d$();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(uV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=dV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:VW,value:null!==(i=t[VW])&&void 0!==i?i:0},{id:WW,value:null!==(n=t[WW])&&void 0!==n?n:0},{id:YW,value:a$(null!==(s=t[YW])&&void 0!==s?s:e[YW])},{id:UW,update:{callback:(t,e)=>{const i=a$(e[YW]);return e[VW]-i.left-i.right},dependency:[VW,YW]}},{id:GW,update:{callback:(t,e)=>{const i=a$(e[YW]);return e[WW]-i.top-i.bottom},dependency:[WW,YW]}},{id:$W,update:{callback:(t,e)=>{const i=a$(e[YW]);return(t||new Cs).setValue(i.left,i.top,i.left+e[UW],i.top+e[GW])},dependency:[UW,GW,YW]}},{id:XW,value:null!==(r=t[XW])&&void 0!==r?r:e[XW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===nV.glyph?{glyphType:t.glyphType}:t.type===nV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(VW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(WW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(UW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(GW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(YW);if(arguments.length){const i=a$(t);return this.updateSignal(e,i),i}return a$(e.output())}autoFit(t){const e=this.getSignalById(XW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById($W);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=dV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===nV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||_$;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(uV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(uV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(uV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{jY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(uV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(uV.BEFORE_MARK_RENDER_END),jY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(uV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return P$(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return P$(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(uV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(uV.AFTER_DO_RENDER)}evaluate(t){var e,i;return P$(this,void 0,void 0,(function*(){const n=o$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=dV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=dV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=dV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=o$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=dV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=dV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=dV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!r$.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return jY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=Ha(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return P$(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(VW,t)),e!==this.height()&&(n=!0,this.updateSignal(WW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,h=h$(e);if(!h)return;const{source:c,type:d}=h,u=Xi((m=h).markId)?t=>t&&t.mark.id()===m.markId:Xi(m.markName)?t=>t&&t.mark.name()===m.markName:Xi(m.type)?t=>t&&t.mark.markType===m.type:()=>!0,p=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:tn(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),g=FN(l,this),f=l$(((t,e)=>{const n=c===HW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===zW&&(t=KW(0,t,e,d,zW));let s=!1;if((!i||i(t))&&(!u||u(e))&&p.length){const e=g.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});p.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var m;if(c===HW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||qi(n)&&!n[i])}(this._eventConfig,HW,d))return this.addEventListener(d,f,jW),()=>{this.removeEventListener(d,f)}}else if(c===zW)return yj.addEventListener(d,f),this._eventListeners.push({type:d,source:yj,handler:f}),()=>{yj.removeEventListener(d,f);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===yj&&t.handler===f));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);tn(e)?i.type=e:qi(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:NW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?tn(r)?r:r.user:NW,o=r&&a===r.user&&(s===r.element||Xi(s)&&Xi(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==NW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!Xi(document)&&document.body:this.container;return e?Xi(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new NY(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e,i;this.grammars=new C$((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new C$((t=>t.id())),this._options.logger&&(i=this._options.logger,ol=i),this.logger=ll(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new HY,this.animate=new T$(this),this._morph=new M$,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{en(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[HW,zW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&yj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=dV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==nV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=yj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&yj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),BN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const I$=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{PN(e,t[e],!0)}))}))};I$(xV);const D$=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var L$,O$,F$;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(L$||(L$={})),function(t){t.chart="chart",t.window="window"}(O$||(O$={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(F$||(F$={}));const z$=`${Jj}_waterfall_default_seriesField`,H$=`${Jj}_DEFAULT_DATA_INDEX`,j$=`${Jj}_DEFAULT_DATA_KEY`,N$=`${Jj}_DEFAULT_DATA_SERIES_FIELD`,V$=`${Jj}_DEFAULT_SERIES_STYLE_NAME`;var W$;!function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.Built_In=99]="Built_In"}(W$||(W$={}));const U$=`${Jj}_STACK_START`,G$=`${Jj}_STACK_END`,Y$=`${Jj}_STACK_START_PERCENT`,$$=`${Jj}_STACK_END_PERCENT`,X$=`${Jj}_STACK_START_OffsetSilhouette`,K$=`${Jj}_STACK_END_OffsetSilhouette`,q$=`${Jj}_SEGMENT_START`,Z$=`${Jj}_SEGMENT_END`;var J$,Q$;!function(t){t[t.Axis_Grid=100]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark"}(J$||(J$={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(Q$||(Q$={}));const tX=["linear","radial","conical"],eX={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},iX={innerRadius:0,outerRadius:1,startAngle:MN,endAngle:CN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var nX,sX;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(nX||(nX={})),function(t){t.middle="middle",t.start="start",t.end="end"}(sX||(sX={}));const rX={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,tickSize:Oj,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Oj/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Dj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Dj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},aX={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},oX={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},lX={name:"light",padding:12,fontFamily:Ij,colorScheme:{default:{dataScheme:[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Dj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Dj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Kj,line:Uj,area:Fj,bar:zj,bar3d:Hj,pie:Yj,pie3d:$j,map:Gj,radar:Xj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:jj,funnel3d:Nj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:qj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:Wj,treemap:Zj,sunburst:iX,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Dj},minLabel:{position:sX.end},maxLabel:{position:sX.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Dj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Dj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...oX,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...oX,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...oX},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...oX}},axis:rX,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10}},axisY:{label:{space:20},title:{space:20,autoRotate:!0}},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Dj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Dj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!1,background:{size:5,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:8,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{lineWidth:1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{lineWidth:1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:aX,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Lj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Dj,lineHeight:Lj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Dj,fontFamily:Ij}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Dj,fontFamily:Ij}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}}}},hX=new Map([[lX.name,lX]]),cX=lX.name;class dX{static instances=new Map;static registerInstance(t){dX.instances.set(t.id,t)}static unregisterInstance(t){dX.instances.delete(t.id)}static getInstance(t){return dX.instances.get(t)}static instanceExist(t){return dX.instances.has(t)}static forEach(t,e=[],i){const n=Cn(e);return dX.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class uX{static themes=new Map;static _currentThemeName=cX;static registerTheme(t,e){t&&uX.themes.set(t,xn({},uX.getDefaultTheme(),e))}static getTheme(t){return uX.themes.get(t)||uX.getDefaultTheme()}static removeTheme(t){return uX.themes.delete(t)}static themeExist(t){return uX.themes.has(t)}static getDefaultTheme(){return uX.themes.get(cX)}static setCurrentTheme(t){uX.themeExist(t)&&(uX._currentThemeName=t,dX.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return uX.getTheme(uX._currentThemeName)}static getCurrentThemeName(){return uX._currentThemeName}}uX.registerTheme(cX,hX.get(cX)),hX.forEach(((t,e)=>{e!==cX&&uX.registerTheme(e,t)}));const pX=(t,e,i)=>new wr({defaultFontParams:{fontFamily:Bj,fontSize:14},getTextBounds:i?void 0:xB,specialCharSet:"-/: .,@%'\"~"+wr.ALPHABET_CHAR_SET+wr.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),gX=_B({});function fX(t,e){for(let i=0;it.key===e))}function yX(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const _X=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;s{un(t.state[e])||(t.state[e]=SX(t.state[e]))})),t}function xX(t){return un(t)?null:(Object.keys(t).forEach((e=>{un(t[e])||(t[e]=SX(t[e]))})),t)}function SX(t){return un(t)||t.angle&&(t.angle=Es(t.angle)),t}var wX;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(wX||(wX={}));class AX{static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Za,fields:to,filter:s,fold:Qa};static dataParser={csv:po,dsv:uo,tsv:go};static _layout={};static registerChart(t,e){AX._charts[t]=e}static registerSeries(t,e){AX._series[t]=e}static registerComponent(t,e){AX._components[t]=e}static registerMark(t,e){AX._marks[t]=e}static registerRegion(t,e){AX._regions[t]=e}static registerTransform(t,e){AX.transforms[t]=e}static registerLayout(t,e){AX._layout[t]=e}static createChart(t,e,i){if(!AX._charts[t])return null;return new(0,AX._charts[t])(e,i)}static createRegion(t,e,i){if(!AX._regions[t])return null;return new(0,AX._regions[t])(e,i)}static createSeries(t,e,i){if(!AX._series[t])return null;return new(0,AX._series[t])(e,i)}static createMark(t,e,i){if(!AX._marks[t])return null;const n=new(0,AX._marks[t])(e,i);return n.type===wX.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(AX._components)}static getComponentInKey(t){return AX._components[t]}static getLayout(t){return AX._layout[t]}static getSeries(t){return AX._series[t]}}const kX=(t,e,i)=>{const n=t.getRegionsInIds(Cn(e.layoutBindRegionID));return n?.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},MX=(t,e)=>t===e||!Xi(t)&&!Xi(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),CX=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},TX="monotone",EX="linearClosed";var RX;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(RX||(RX={}));var PX;function BX(t){return"bottom"===t||"top"===t}function IX(t){return"left"===t||"right"===t}function DX(t){return"z"===t}function LX(t,e){return Xh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(PX||(PX={}));const OX=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&kX(t,n,i)));return n.length?n:null},FX=t=>t.fieldX[0],zX=t=>t.fieldY[0],HX=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=jX(t,n,"x",FX);e&&o.push(e)})),a&&a.forEach((t=>{const e=jX(t,s,"y",zX);e&&o.push(e)})),o.length?o:null},jX=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return NX(t,a,n)},NX=(t,e,i)=>{const n=t.getScale();if(!n||!Wl(n.type))return null;if(Xi(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=CX(e,t,"cartesian",i??(BX(t.orient)?FX:zX));return{index:s,value:e,axis:t,data:r}},VX=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&kX(t,n,i)));return n.length?n:null},WX=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&Wl(e.type)){const h=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=Ol({x:1,y:0},c);d=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(d,r);const u=Fl(c),p=a[0]?.getScale(),g=p?.range();if((d-r?.[0])*(d-r?.[1])>0||(u-g?.[0])*(u-g?.[1])>0)return;const f=Math.abs(r[0]-r[1])/i.length/2,m=e.invert(d+f);if(Xi(m))return;let y=e.domain().findIndex((t=>t?.toString()===m.toString()));y<0&&(y=void 0);const _=CX(m,t,"polar",l);o.push({index:y,value:m,axis:t,data:_})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&Wl(e.type)){const a=t.getCenter(),h={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let c=Ol({x:1,y:0},h);c<-Math.PI/2&&(c=2*Math.PI+c);const d=Fl(h),u=r[0]?.getScale(),p=u?.range();if((c-p?.[0])*(c-p?.[1])>0||(d-i?.[0])*(d-i?.[1])>0)return;const g=e.invert(d);if(Xi(g))return;let f=e.domain().findIndex((t=>t?.toString()===g.toString()));f<0&&(f=void 0);const m=CX(g,t,"polar",l);o.push({index:f,value:g,axis:t,data:m})}})),o.length?o:null};class UX{_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=HX(this._chart,{x:t,y:e})??[],n=WX(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!Wl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=NX(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var GX;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(GX||(GX={}));const YX={[GX.dimensionHover]:class extends UX{_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:O$.chart},callback:this.onMouseMove}),qo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:O$.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),qo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!MX(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[GX.dimensionClick]:class extends UX{constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:O$.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let $X=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(YX[t]){const e=new YX[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(YX[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class XX{_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(F$.vchart,[]),this._levelNodes.set(F$.chart,[]),this._levelNodes.set(F$.model,[]),this._levelNodes.set(F$.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const KX={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class qX{globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||O$.chart),n=this.getEventListeners(e.filter?.source||O$.chart);i.get(t)||i.set(t,new XX);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||O$.chart),s=this.getEventListeners(e?.filter?.source||O$.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||O$.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||O$.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(F$.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(F$.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(F$.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(F$.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(O$.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(O$.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if($i(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&pn(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return KX[n]&&(n=KX[n]),(!t.type||n===t.type)&&(!Ki(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=Ki(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=Ki(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&Ki(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();Ki(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:pn(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:Ki(t.id)?F$.model:F$.vchart:F$.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ts(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=Qn(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=O$.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==F$.model&&i!==F$.mark||(n=e.type),e?.source&&(s=e.source),Ki(e?.id)&&(o=e?.id,i=F$.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case O$.chart:return this._viewBubbles;case O$.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case O$.chart:return this._viewListeners;case O$.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return D$.includes(t)||Object.values(uV).includes(t)||Object.values(L$).includes(t)}}function ZX(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function JX(t,e,i){t.getParser(e)||t.registerParser(e,i)}const QX=new Map;let tK;function eK(t,e,i={type:"geojson",centroid:!0}){QX.has(t)&&Uo(`map type of '${t}' already exists, will be overwritten.`),tK||(tK=new zo,JX(tK,"geojson",Bo),JX(tK,"topojson",Do),ZX(tK,"simplify",Za));const n=new jo(tK),s=xn({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),QX.set(t,n)}function iK(t,e=!1){let i=e;return t.latestData instanceof jo&&(i=!1),i?yn(t.latestData):t.latestData.slice()}const nK=(t,e)=>0===t.length?[]:1===t.length?iK(t[0],e?.deep):t.map((t=>iK(t,e?.deep)));function sK(t,e,i){ZX(e=e instanceof zo?e:t.dataSet,"copyDataView",nK);const n=new jo(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function rK(t,e,i=[]){if(t instanceof jo)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new jo(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!tn(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Go("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const aK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)}}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!tn(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&yj.getCancelAnimationFrame()(this._rafId),this._rafId=yj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===O$.chart){const n=function(n,s){const r=s?.mark?.context??{},a=Ki(r.modelId)?r.modelId:null,o=Ki(r.markId)?r.markId:null,l=Ki(r.modelUserId)?r.modelUserId:null,h=Ki(r.markUserId)?r.markUserId:null,c={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,c)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===O$.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===O$.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===O$.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(Xi(e))return;const i=e.id(),n=t.grammarType;Xi(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(Xi(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];Ki(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return Ki(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return Ko(this._option.mode)?globalThis:this.getStage()?.window}}async function gK(t){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){console.error("getCanvasDataURL",t)}return t.toDataURL()}class fK{id=Qo();static useChart(t){t.forEach((t=>AX.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>AX.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>AX.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>AX.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>AX.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){AX.registerTransform(t,e)}static registerMap(t,e,i){eK(t,e,i)}static unregisterMap(t){!function(t){QX.has(t)?QX.delete(t):Uo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,QX.get(e);var e}static hideTooltip(t=[]){dX.forEach((t=>t?.hideTooltip?.()),t)}static InstanceManager=dX;static ThemeManager=uX;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=xn(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,...a}=this._option;i&&(this._container=tn(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=uX.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new pK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,...a,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new qX(this,this._compiler),this._event=new $X(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!Ko(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(L$.initialized,{}),dX.registerInstance(this)):Go("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=ec(tn(t)?JSON.parse(t):t))}_initData(){if(Xi(this._dataSet))return void Uo("dataSet is not initialized");const t=Cn(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Go("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=Qn(((...t)=>{const{width:e,height:i}=Ha(this._container,Qj,tN),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof zo?t:new zo,JX(this._dataSet,"dataview",Lo),JX(this._dataSet,"array",e),ZX(this._dataSet,"stackSplit",aK),ZX(this._dataSet,"copyDataView",nK);for(const t in AX.transforms)ZX(this._dataSet,t,AX.transforms[t]);for(const t in AX.dataParser)JX(this._dataSet,t,AX.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return Ki(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)}))),this._event.emit(L$.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)}))),this._event.emit(L$.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),QX.clear(),tK=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,dX.unregisterInstance(this)}async updateData(t,e,i){if(Xi(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=Cn(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):en(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new jo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(Xi(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new jo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(tn(t)&&(t=JSON.parse(t)),e&&(t=xn({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=ec(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}_updateCurrentTheme(){tn(this._spec?.theme)?(this._currentTheme=xn({},uX.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=xn({},uX.getTheme(this._currentThemeName),this._spec?.theme??{})}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return uX.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===n.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(Ki(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===n.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===n.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===n.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await gK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!Ko(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(Ki(this._container))return this._container;let t;return t=tn(this._canvas)?document?.getElementById(this._canvas):this._canvas,Ki(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(un(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(Ki(n)?r=this._chart.getSeriesInUserId(n):Ki(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),tc(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||Xi(t)||un(e))return null;if(!en(t)){const{axisId:n,axisIndex:s}=e;let r;if(Ki(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):Ki(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Uo("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return Ki(n)?r=this._chart.getSeriesInUserId(n):Ki(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?tc(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Uo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(hK||(hK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(cK||(cK={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(dK||(dK={}));class mK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){Xi(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,xn({},mK.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return[...this._children]}getMarksInType(t){const e=Cn(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}class yK{event;interaction;_option;_marks=new mK;_markReverse=new mK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){un(t.stateStyle[hK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),un(t.stateStyle[hK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(GX.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=en(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(hK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(hK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(hK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(hK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(hK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(hK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class _K{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class vK extends _K{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=Q$.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Jh(Qh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=Xi(t.minHeight)?null:Zh(t.minHeight,e.height,e),this._maxHeight=Xi(t.maxHeight)?null:Zh(t.maxHeight,e.height,e),this._minWidth=Xi(t.minWidth)?null:Zh(t.minWidth,e.width,e),this._maxWidth=Xi(t.maxWidth)?null:Zh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Zh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Zh(t.height,e.height,e)},{height:9}),Xi(t.offsetX)||(this.layoutOffsetX=Zh(t.offsetX,e.width,e)),Xi(t.offsetY)||(this.layoutOffsetY=Zh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{Xi(this._spec[i])||(e[i]=Zh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};Xi(n)||(r.width-=n),Xi(s)||(r.width-=s),Xi(e)||(r.height-=e),Xi(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(Xi(n)?Xi(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,Xi(e)?Xi(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){an(t)&&(this._layoutStartPoint.x=t),an(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){an(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),an(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}_setRectInSpec(t){const e={...t};return this._layoutRectLevelMap.width<9?(Xi(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),Xi(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(Xi(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),Xi(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class bK extends _K{grammarType;id=Qo();_product;getProduct(){if(Ki(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return Ki(e)&&Ki(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){Ki(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(Ki(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(Ki);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class xK extends bK{grammarType=lK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}Ki(this._value)&&this._product.value(this._value),Ki(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class SK extends _K{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new xK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class wK extends SK{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(xn(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class AK extends wK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class kK extends vK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new mK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=Qo(),this._originalSpec=t,this._spec=ic(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new $X(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new AK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&An(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=ic(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(Xi(t)||Xi(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=xn({},e?.[Cn(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),en(t))return t.map((t=>qi(t)&&!$i(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];qi(n)&&!$i(n)&&(jh(n)?e[i]=Hh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){Ki(t)&&Ki(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!Ki(t)||!Ki(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${Jj}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=AX.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const MK={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",rectRound:"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"},CK={symbol:function(t,e){return"shape"===t?MK[e]??e:e}};const TK={};Object.values(hK).forEach((t=>{TK[t]=!0}));const EK={[hK.STATE_HOVER]:hK.STATE_HOVER_REVERSE,[hK.STATE_SELECTED]:hK.STATE_SELECTED_REVERSE,[hK.STATE_DIMENSION_HOVER]:hK.STATE_DIMENSION_HOVER_REVERSE};function RK(t){return EK[t]}class PK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!un(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=RK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=RK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=RK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=RK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class BK extends wK{id=Qo();stateKeyToSignalName=t=>`${Jj}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===oK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===oK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===oK.enter?oK.appear:oK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===oK.enter?oK.appear:oK.none}}}}class IK extends kK{static type="region";modelType="region";type=IK.type;_series=[];layoutType="region";layoutZIndex=J$.Region;animate;interaction=new PK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new BK({getCompiler:e.getCompiler})),Ki(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:wX.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",W$.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",W$.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:wX.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:wX.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",W$.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(J$.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",W$.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",W$.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",W$.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||Cn(t.userId).includes(e.userId))&&(!Ki(t.specIndex)||!e.getSpecIndex||Cn(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(L$.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new yK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in cK)un(t.stateStyle[cK[e]])||this.interaction.registerMark(cK[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class DK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient&&(this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const LK=[wX.line,wX.area,"trail"];function OK(t){return LK.includes(t)}class FK extends wK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];Ki(n.domain)&&(s.domain=n.domain),Ki(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=Yi(OK)?n:!t.mark||OK(t.mark.markType);let s=!1,r=!1;if(Ki(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!TK[t])).map((t=>[t,10])),n=!t.mark||OK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(en(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Jj)));n=t.datums.some((t=>i&&en(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(qi(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Jj)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(Nl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class zK extends bK{grammarType=lK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();Xi(t)||(Xi(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class HK extends zK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return Ki(t)?t:`${Jj}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;Xi(t)||Ki(this.getProduct())||this._initProduct(t)}}class jK extends bK{grammarType=lK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=J$.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){Ki(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){Xi(this._data)&&this.initMarkData({...this._option,mark:this}),Ki(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new FK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new $X(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new HK(t)}stateKeyToSignalName(t){return`${Jj}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(Ki(e)&&this.removeProduct());if(Ki(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),Xi(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(Xi(this._data))return;this._data.compile();const t=this._data.getProduct();Ki(this._product)&&Ki(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[hK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!$i(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(uV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===oK.appear&&this.runAnimationByState(oK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),CK[a]?CK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class NK extends jK{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(Ki(t.id)&&(this._userId=t.id),Yi(t.interactive)&&(this._interactive=t.interactive),Ki(t.zIndex)&&this.setZIndex(t.zIndex),Yi(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(rn(t))return kl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(kl)),t}return"function"==typeof t?(e,i,n,s)=>kl(t(e,i,n,s)):t}isUserLevel(t){return[W$.User_Mark,W$.User_Series,W$.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(Xi(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];Xi(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;Ki(r)&&r<=n&&xn(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Vl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return tn(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=Uh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;return s=this.stateStyle[i]?.[t]?this._computeStateAttribute(this.stateStyle[i][t],t,e,i,n):this._computeStateAttribute(this.stateStyle.normal[t],t,e,i,n),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,s):s}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):tX.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):Vl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",W$.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=$i(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,W$.User_Mark,e)}else this.setStyle(i,t,W$.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let l=s,h=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(l=t),h||(h=e)}const c=Fh(Oh(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),d={},u={...eX[n],...a};return Object.keys(u).forEach((t=>{const n=u[t];"stops"===t?d.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??l?.scale(e[h]);return $i(s)&&(a=s(e,this._attributeContext,i,o)),Ki(n)&&(a=Wo.SetOpacity(a,n)),{offset:$i(r)?r(e,this._attributeContext,i,o):r,color:a||c[0]}})):$i(n)?d[t]=n(e,this._attributeContext,i,o):d[t]=n})),d.gradient=n,d}_computeThresholdAttr(t){return(new Ph).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class VK extends NK{static type=wX.group;type=VK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Uo("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Uo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class WK extends NK{static type=wX.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(nV.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}fK.useMark([WK,VK]),AX.registerRegion("region",IK),AX.registerLayout("base",DK);var UK,GK,YK;!function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(UK||(UK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(GK||(GK={}));class $K{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Uh("colorOrdinal"):Uh(t.type)),e?(en(t.range)&&e.range(t.range),en(t.domain)&&(el(t.domain)||e.domain(t.domain)),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(An(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!An(n.range,s.range())&&(s.range(n.range),e.reRender=!0),el(n.domain)?e.reRender=!0:An(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{el(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{fX(e,[{key:t,operations:Nl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&fX(e,[{key:i.field,operations:Nl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!el(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=Nl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{Nl(e.type)?(Xi(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),Xi(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;Nl(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!Xi(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(Nl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(Nl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));Nl(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(Xi(t.field)||!Xi(t.changeDomain)&&"none"!==t.changeDomain&&!Xi(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class XK{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(L$.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][G$]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[G$],s>=0?(t[U$]=e,e+=t[G$],t[G$]=e):(t[U$]=i,i+=t[G$],t[G$]=i)})),t.values.forEach((t=>{s=t[G$];const r=s>=0?e:i;n=s>=0?1:-1,t[Y$]=Math.min(1,t[U$]/r)*n,t[$$]=Math.min(1,t[G$]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[G$]=function(t){if(an(t))return t;const e=+t;return an(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class KK extends _K{type="chart";id=Qo();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:Qj,height:tN};getLayoutRect(){return this._layoutRect}_viewRect={width:Qj,height:tN};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:Qj,y2:tN};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=Qh(t.padding??this._theme?.padding),this._event=new $X(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new XK(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),fn(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=AX.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=rK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),Ki(t.regionId)?i=this.getRegionsInUserId(t.regionId):Ki(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=AX.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&Cn(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=AX.getComponents();let i,s;const r=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(AX.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(L$.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(L$.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Cn(t).some((t=>Ki(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof kK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof NK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof NK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(Ki(t)&&Ki(e))this._canvasRect={width:t,height:e};else{let i=Qj,n=tN;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=Ha(this._option.container,Qj,tN);i=t,n=e}else if(r&&Ko(this._option.mode)){let t;t=tn(r)?document?.getElementById(r):r;const{width:e,height:s}=Ha(t,Qj,tN);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;en(t)?e.range=t.map((t=>Hh(t,this._theme?.colorScheme))):(e.type=t.type,t.domain&&(e.domain=t.domain),e.range=t.range)}return e.range?.length||(e.range=Oh(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new $K(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Oh(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&Cn(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};en(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Jh(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(un(t[n]))continue;const s=t[n];let r={stateValue:n};r=$i(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(hK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(hK.STATE_HOVER,!0,t,e,i)}initEvent(){[L$.dataZoomChange,L$.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(uV.AFTER_MARK_RENDER_END,e)};this._event.on(uV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?Cn(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||$i(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===GX.dimensionHover||s===GX.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===n.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===n.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class qK extends KK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function ZK(t){t.crosshair=Cn(t.crosshair||{}).map((e=>xn({[t.direction===$h.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(YK||(YK={}));const JK=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:h}=e,c=[],{dimensionValues:d,dimensionData:u}=h().latestData,p=Array.from(d[i]);let g={start:0,end:0,lastIndex:null};return p.forEach(((t,e)=>{const i={start:g.end,end:g.end,lastIndex:g.lastIndex,lastEnd:g.end,index:t,isTotal:!1};u[t].forEach((t=>{let h=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(h=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,g);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!Xi(t[a.collectCountField])){const i=c.length-+t[a.collectCountField],n=c.length-1;i<0?console.warn("total.collectCountField error"):e=c[i].start,n<0?console.warn("total.collectCountField error"):o=c[n].end}else a.startField&&!Xi(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!Xi(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===p.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,h=!0);h||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=h,(Xi(o)||o===z$)&&(t[z$]=h?l.total:+t[n]>=0?l.increase:l.decrease)})),g={...i,lastIndex:t},c.push(i)})),c},QK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},tq=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:eq(t.map((t=>t.latestData)).flat(),e.fields,i)}};function eq(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>eq(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class iq{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new jo(e instanceof zo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),ZX(e,"dimensionTree",tq),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const nq=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class rq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new mK;_markReverse=new mK;constructor(t,e){this._spec=t,this._option=e,this.event=new $X(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(hK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(hK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(Cn(i).forEach((e=>{t.on(e,{level:F$.chart},this.onHover)})),n&&"none"!==n&&Cn(n).forEach((e=>{t.on(e,{level:F$.vchart,source:O$.chart},this.onUnHover)}))),s&&(Cn(r).forEach((e=>{t.on(e,{level:F$.mark},this.onSelect)})),a&&"none"!==a&&Cn(a).forEach((e=>{t.on(e,{level:F$.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=sq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;Yi(i)?this._hover.enable=i:qi(i)&&(this._hover.enable=!0,this._hover=xn(this._hover,i));const n=this._spec.select;Yi(n)?this._select.enable=n:qi(n)&&(this._select.enable=!0,this._select=xn(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,hK.STATE_HOVER)||this.interaction.getEventElement(hK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,hK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(hK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(hK.STATE_HOVER,t.item),this.interaction.reverseEventElement(hK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(hK.STATE_HOVER);this.interaction.clearEventElement(hK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(hK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,hK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(hK.STATE_SELECTED);this.interaction.clearEventElement(hK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(hK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(hK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(hK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(hK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(hK.STATE_SELECTED);const e=this.interaction.getEventElementData(hK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,hK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class aq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const oq=(t,e)=>Ki(e)?t.map((t=>e[t])):void 0,lq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),hq=t=>!Xi(t)&&(en(t)?t.length>0&&t.every(Ki):Object.keys(t).length>0);function cq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(Ki(s.regionId)?[s.regionId]:void 0,Ki(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=Ki(s)?t[s]:void 0,a=Ki(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=oq(i,t);let h=oq(n,t);const c=hq(h),d=!c&&Ki(s)&&Xi(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,u=i.map(((t,e)=>[t,e])).filter((([,t])=>Xi(l?.[t])));let p=[l??[]];u.length>0&&u.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];p.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),p=s})),p.forEach((l=>{if(d){const r=t.getViewData()?.latestData.filter(lq(i,l));a.forEach((a=>{const d=r.find((t=>t[s]===a));if(h=oq(n,d),!hq(h))return;const u=t.dataToPosition(d);Xi(u)||isNaN(u.x)||isNaN(u.y)||o.push({pos:u,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===GK.pie){const t=e,a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToCentralPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}else{const t=e;if(d){const d=t.getViewData()?.latestData.filter(lq(i,l)),u=d.find((t=>t[s]===r));a.forEach((r=>{if(h=oq(n,u),!hq(h))return;const a=t.dataToPosition(u);Xi(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),h=r.getLayoutStartPoint(),c=r.getLayoutRect(),d=n.globalInstance.getContainer(),u={x:0,y:0,...d?ja(d):{}},p=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>lq(e,i)(t)&&lq(n,s)(t)&&(Xi(r)||lq([r],[a])(t))));return o},g=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),c.width),y:Math.min(Math.max(t.y,0),c.height)}))(t),i=s.x??h.x+e.x,n=s.y??h.y+e.y;return{canvasX:i,canvasY:n,clientX:u.x+i,clientY:u.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>p(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:O$.chart,event:g({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return fK.globalConfig.uniqueTooltip&&fK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...p(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:O$.chart,event:g(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return fK.globalConfig.uniqueTooltip&&fK.hideTooltip(a.id),l}return"none"}const dq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return Ki(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function uq(t){return Xi(t.mark)&&Xi(t.model)&&Xi(t.datum)}class pq extends aq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];Ki(i)&&(e[t]={...i,title:Ki(i.title)?$i(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:Ki(i.content)?$i(i.content)?i.content:Cn(i.content).map((t=>$i(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=dq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:Ki(e)?Cn(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of Cn(e)){const e=this.series.getSeriesStyle(t)?.(i);if(Ki(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return Ki(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const gq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},fq={min:t=>t===gq.min()?0:t,max:t=>t===gq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===gq.min()?0:t,"array-max":t=>t===gq.max()?0:t};const mq={min:function(t,e){return tl(e)?Math.min(t,e):t},max:function(t,e){return tl(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>tl(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>tl(t)));return 0===i.length?t:Math.max(t,...i)}},yq=(t,e)=>{const i={};let n=e.fields;if($i(n)&&(n=n()),!n?.length||!t?.length)return i;n=fX([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!Xi(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=gq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=mq[n](i[t.key][n],s)})),i[t.key][n]=fq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},_q=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>tl(t[s])));else if("zero"===n)return t.forEach((t=>{tl(t[s])||(t[s]=0)})),t;return t};class vq extends zK{_compileProduct(){const t=this._data?.latestData;Xi(t)||Ki(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const bq=`${Jj}_HIERARCHY_DEPTH`,xq=`${Jj}_HIERARCHY_ROOT`,Sq=`${Jj}_HIERARCHY_ROOT_INDEX`,wq=()=>({keyMap:new Map});function Aq(t,e,i){t&&(this._seriesField||(t[N$]=this.getSeriesKeys()[0]),t[H$]=e,t[j$]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function kq(t,e,i,n=0,s,r){void 0===r&&(r=e),Aq.bind(this)(t,e,i),t[bq]=n,t[xq]=s||t[this.getCategoryField()],t[Sq]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>kq.bind(this)(e,n,i,t[bq]+1,t[xq],r)))}class Mq extends kK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[UK.label]:{name:UK.label,type:wX.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){Ki(t)&&(this._seriesField=t,this.getMarksInType([wX.line,wX.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(L$.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&Ki(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(L$.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(Xi(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),Yi(this._spec.stack)&&(this._stack=this._spec.stack),Yi(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),Yi(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),Ki(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=sK(this._rawData,this._dataSet,{name:`${Jj}_series_${this.id}_viewDataFilter`});const t=sK(this._viewDataFilter,this._dataSet,{name:`${Jj}_series_${this.id}_viewData`});this._data=new vq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(ZX(this._option.dataSet,"invalidTravel",_q),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new iq(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${Jj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${Jj}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){ZX(this._dataSet,"dimensionStatistics",yq);const n=new jo(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=fX(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&fX(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${Jj}_series_${this.id}_viewStackData`;this._viewStackData=new jo(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(Xi(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(tn(t))return e[t];if(en(t)&&t.every((t=>tn(t))))return t.map((t=>e[t])).join("-");if($i(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(ZX(this._rawData.dataSet,"addVChartProperty",nq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(L$.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(L$.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(L$.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(L$.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(L$.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||Xi(e)?[]:tn(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:wX.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Jj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Jj}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||Xi(t.dataId)&&Xi(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new rq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??N$;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:V$,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,V$)}))}afterInitMark(){this.event.emit(L$.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",W$.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new pq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??N$,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Oh(this._option.getTheme().colorScheme,this.type);return(new Vh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??N$}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=xn({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:o,dataProductId:l,parent:h,isSeriesMark:c,dataStatistics:d,depend:u,label:p,progressive:g,support3d:f=this._spec.support3d||!!this._spec.zField,morph:m=!1}=e,y=super._createMark(t,{key:i??this._getDataIdKey(),support3d:f,dataStatistics:d??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(Ki(y)){this._marks.addMark(y),c&&(this._seriesMark=y),Xi(h)?this._rootMark?.addMark(y):!1!==h&&h.addMark(y),Xi(o)?(y.setDataView(this.getViewData(),this.getViewDataProductId()),y.setSkipBeforeLayouted(!0)):!1!==o&&y.setDataView(o,l),Yi(s)&&y.setSkipBeforeLayouted(s),Ki(u)&&y.setDepend(...Cn(u)),Ki(p)&&y.setLabelSpec(p);const t=this.getSpec()||{};y.setMorph(m),y.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),y.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),Xi(g)||y.setProgressiveConfig(g),Xi(n)||y.setGroupKey(n),this.initMarkStyleWithSpec(y,xn({},r,a||t[y.name]))}return y}_getDataIdKey(){return super._getDataIdKey()??j$}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==G$&&t!==$$&&t!==U$&&t!==Y$||(t=this.getStackValueField()),yX(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=AX.getSeries(this.type);return Object.values(t.mark??{})}return t}}class Cq extends Mq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Cn(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Cn(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Cn(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=$h.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&this._fieldX.forEach((e=>{const i={key:e,operations:[]};Nl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&this._fieldY.forEach((e=>{const i={key:e,operations:[]};Nl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};Nl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===$h.vertical?Cn(this._spec.yField)[0]:Cn(this._spec.xField)[0]}setValueFieldToStack(){this.direction===$h.vertical?(this.setFieldY(G$),this.setFieldY2(U$)):(this.setFieldX(G$),this.setFieldX2(U$))}setValueFieldToPercent(){this.direction===$h.vertical?(this.setFieldY($$),this.setFieldY2(Y$)):(this.setFieldX($$),this.setFieldX2(Y$))}setValueFieldToStackOffsetSilhouette(){this.direction===$h.vertical?(this.setFieldY(K$),this.setFieldY2(X$)):(this.setFieldX(K$),this.setFieldX2(X$))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Vo(t.xField,i)&&Vo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),Ki(this._spec.direction)&&(this._direction=this._spec.direction),this._direction===$h.vertical?(this.setFieldY2("y1"),this.setFieldX2(this._spec?.x2Field)):(this.setFieldX2("x1"),this.setFieldY2(this._spec?.y2Field)),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(Cn(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(Cn(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[0]:Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===$h.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===$h.vertical?Cn(this._spec.yField??this.fieldY):Cn(this._spec.xField??this.fieldX)}}const Tq=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};const Eq={type:"clipIn"},Rq={type:"fadeIn"};function Pq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===$h.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===$h.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Rq;default:return Eq}}function Bq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=i?.[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const Iq=(t,e=!0)=>({type:t.direction===$h.horizontal?"growWidthIn":"growHeightIn",options:Bq(t,e)}),Dq=(t,e=!0)=>({type:t.direction===$h.horizontal?"growWidthOut":"growHeightOut",options:Bq(t,e)}),Lq={type:"fadeIn"},Oq={type:"growCenterIn"};function Fq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Lq;case"scaleIn":return Oq;default:return Iq(t)}}const zq={type:"clipIn"},Hq={type:"fadeIn"};function jq(t,e){switch(e){case"grow":return(t=>({type:t.direction===$h.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===$h.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Hq;default:return zq}}function Nq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Vq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Nq(t,!0,oK.appear)}),Wq={type:"fadeIn"},Uq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Nq(t,!0,oK.enter)}),Gq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Nq(t,!0,oK.exit)}),Yq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:Nq(t,!0,oK.exit)});function $q(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Wq;case"growRadius":return Vq({...t,growField:"radius"});default:return Vq({...t,growField:"angle"})}}const Xq={type:"fadeIn"};function Kq(t,e){return"fadeIn"===e?Xq:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function qq(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const Zq=t=>({type:t.direction===$h.horizontal?"growWidthOut":"growHeightOut",options:qq(t)}),Jq={type:"fadeIn"};function Qq(t,e){return!1===e?{}:"fadeIn"===e?Jq:(t=>({type:t.direction===$h.horizontal?"growWidthIn":"growHeightIn",options:qq(t)}))(t)}const tZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function eZ(t,e,i){return"fadeIn"===e?tZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function iZ(t,e,i){return"fadeIn"===e?tZ(i):((t,e)=>{const i=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const nZ=(t,e)=>({custom:LC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class sZ extends dC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;$i(r)&&$i(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);an(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);an(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class rZ extends IC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new As(d,u,p,g);return f.defined=e.defined,f}}const aZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},oZ={type:"fadeIn"},lZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),hZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),cZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function dZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return oZ;case"growAngle":return aZ({...t,growField:"angle"});default:return aZ({...t,growField:"radius"})}}const uZ={type:"fadeIn"},pZ={type:"growCenterIn"};function gZ(t,e){switch(e){case"fadeIn":return uZ;case"scaleIn":return pZ;default:return Iq(t,!1)}}const fZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},mZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),yZ={type:"fadeIn"},_Z=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vZ(t,e){return"fadeIn"===e?yZ:mZ(t)}const bZ=t=>({custom:FC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),xZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},SZ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},wZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===iV.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},AZ=(t,e,i)=>{if(un(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},kZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=AZ(r,n,s);return SZ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=AZ(r,n,s);return SZ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),MZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},CZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=MZ(r);return SZ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=MZ(r);return SZ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),TZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},EZ={type:"fadeIn"};function RZ(t){return!1===t?{}:EZ}const PZ={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},BZ={bar:(t,e)=>({appear:Fq(t,e),enter:Iq(t,!1),exit:Dq(t,!1),disappear:Dq(t)}),bar3d:(t,e)=>({appear:Fq(t,e),enter:Iq(t,!1),exit:Dq(t,!1),disappear:Dq(t)}),line:(t,e)=>({appear:jq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:IC,duration:PZ.update.duration,easing:PZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:Pq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:$q(t,e),enter:Uq(t),exit:Gq(t),disappear:Yq(t)}),pie3d:(t,e)=>({appear:$q(t,e),enter:Uq(t),exit:Gq(t),disappear:Yq(t)}),rose:(t,e)=>({appear:dZ(t,e),enter:lZ(t),exit:hZ(t),disappear:cZ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:eZ(t,e,"in"),enter:eZ(t,e,"in"),exit:eZ(t,e,"out"),disappear:"clipIn"===e?void 0:eZ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:rZ,customParameters:t,duration:PZ.update.duration,easing:PZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:iZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:iZ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:sZ,customParameters:t,duration:PZ.update.duration,easing:PZ.update.easing}]}),radarGroup:(t,e)=>({appear:nZ(t,"in"),disappear:nZ(t,"out")}),circularProgress:(t,e)=>({appear:Kq(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:fZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:Qq(t,e),enter:{type:"grow"},disappear:Zq(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:OC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:OC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:bZ(t)}),rangeColumn:(t,e)=>({appear:vZ(t,e),enter:mZ(t),exit:_Z(t),disappear:_Z(t)}),waterfall:(t,e)=>({appear:gZ(t,e),enter:Iq(t,!1),exit:Dq(t,!1),disappear:Dq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:xZ(0,e),enter:kZ(t),exit:CZ(t),disappear:CZ(t)}),circlePacking:(t,e)=>({appear:TZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:RZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:mG},update:{custom:fG},exit:{custom:zC}})},IZ=["appear","enter","update","exit","disappear","normal"];function DZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=$i(n)?n(t,s,r):an(n)?n:0;let l=$i(i)?i(t,s,r):i;return!1===l?0:(l=!0===l?0:l,a*(o+l))},delete t.oneByOne,t}function FZ(t){return t?.[H$]}function zZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function HZ(t){return!function(t){return Ki(t.timeSlices)}(t)&&Ki(t.channel)}class jZ extends NK{static type=wX.rect;type=jZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class NZ extends NK{static type=wX.text;type=NZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}fK.useMark([jZ,NZ]);class VZ extends Cq{static type=GK.bar;type=GK.bar;_barMarkName=UK.bar;_barMarkType=wX.rect;static mark={...Mq.mark,[UK.bar]:{name:UK.bar,type:wX.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...VZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:zZ(this._spec.animation,this._spec.morph,LZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:xn({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===$h.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Gh(this.dataToPositionX(e),t),x1:e=>Gh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Nl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",W$.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Nl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Gh(this.dataToPositionY(t),e),y1:t=>Gh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",W$.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Gh(this.dataToPositionX(e),t),x1:e=>Gh(this.dataToPositionX1(e),t),y:t=>Gh(this.dataToPositionY(t),e),y1:t=>Gh(this.dataToPositionY1(t),e)},"normal",W$.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(DZ(BZ.bar(t,e),LZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Tq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Tq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Tq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class WZ extends NK{static type=wX.rule;type=WZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}fK.useMark([WZ]);class UZ extends VZ{static type=GK.waterfall;type=GK.waterfall;static mark={...VZ.mark,[UK.leaderLine]:{name:UK.leaderLine,type:wX.rule},[UK.stackLabel]:{name:UK.stackLabel,type:wX.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],Xi(this._seriesField)&&(this._seriesField=z$)}getSeriesKeys(){return this._seriesField===z$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),ZX(this._dataSet,"waterfallFillTotal",QK),ZX(this._dataSet,"waterfall",JK),(Xi(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=sK(this.getViewData(),this._dataSet,{name:`${Jj}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new vq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:U$,endAs:G$,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(DZ(BZ.waterfall(t,e),LZ(UK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec),{dataIndex:i}))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(UZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(UZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n}=this._xAxisHelper;return this._direction===$h.vertical?n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("width",t)*i:Gh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n}=this._yAxisHelper;return this._direction===$h.vertical?Gh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("height",t)*i}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===$h.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!Xi(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",W$.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!Xi(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",W$.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===$h.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const GZ=`${Jj}_BOX_PLOT_OUTLIER_VALUE`;var YZ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(YZ||(YZ={}));const $Z=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];en(e)||(e=[e]),i.push(...e.map((e=>{const i={[GZ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class XZ extends pq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(YZ.OUTLIER),value:this.getContentValue(YZ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(YZ.MAX),value:this.getContentValue(YZ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.Q3),value:this.getContentValue(YZ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.MEDIAN),value:this.getContentValue(YZ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.Q1),value:this.getContentValue(YZ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.MIN),value:this.getContentValue(YZ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.SERIES_FIELD),value:this.getContentValue(YZ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===YZ.OUTLIER)return this.series.getOutliersField();if(t===YZ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case YZ.MIN:return this.series.getMinField();case YZ.MAX:return this.series.getMaxField();case YZ.MEDIAN:return this.series.getMedianField();case YZ.Q1:return this.series.getQ1Field();case YZ.Q3:return this.series.getQ3Field();case YZ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===YZ.OUTLIER)return e[GZ];if(t===YZ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case YZ.MIN:return e[this.series.getMinField()];case YZ.MAX:return e[this.series.getMaxField()];case YZ.MEDIAN:return e[this.series.getMedianField()];case YZ.Q1:return e[this.series.getQ1Field()];case YZ.Q3:return e[this.series.getQ3Field()];case YZ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>Ki(t[GZ])}class KZ extends NK{static type=wX.boxPlot;type=KZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(ZN("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(rW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),QV("barBoxplotScaleIn",tW(sW)),QV("barBoxplotScaleOut",eW(sW))):(ZN("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(nW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),QV("boxplotScaleIn",tW(iW)),QV("boxplotScaleOut",eW(iW)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class qZ extends NK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:RX.circle,fill:void 0,lineWidth:0}}}class ZZ extends qZ{static type=wX.symbol;type=ZZ.type}fK.useMark([KZ,ZZ]);class JZ extends Cq{static type=GK.boxPlot;type=GK.boxPlot;static mark={...Mq.mark,[UK.boxPlot]:{name:UK.boxPlot,type:wX.boxPlot},[UK.outlier]:{name:UK.outlier,type:wX.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(JZ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(JZ.mark.outlier,{progressive:t,key:H$,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===$h.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,hK.STATE_NORMAL,W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:rn(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},hK.STATE_NORMAL,W$.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===$h.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Gh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Gh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Gh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Gh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Gh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},hK.STATE_NORMAL,W$.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===$h.vertical?{x:this.dataToPositionX.bind(this),y:e=>Gh(t(this.getDatumPositionValues(e,GZ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Gh(t(this.getDatumPositionValues(e,GZ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,hK.STATE_NORMAL,W$.Series)}}initData(){if(super.initData(),!this._data)return;ZX(this._dataSet,"foldOutlierData",$Z),ZX(this._dataSet,"addVChartProperty",nq);const t=new jo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Jj}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===$h.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1),this._outlierDataView=new vq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===$h.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===$h.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===$h.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(BZ.boxPlot()),i=this._initAnimationSpec(LZ(UK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(DZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(DZ(BZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new XZ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class QZ{setSeriesField(t){Ki(t)&&(this._seriesField=t,this.getMarksInType([wX.line,wX.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(tJ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",W$.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:EX},"normal",W$.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===TX?t===$h.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",W$.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",W$.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(tJ.point,{morph:zZ(this._spec.animation,this._spec.morph,LZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:xn({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",W$.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?tl(t[this.getStackValueField()]):"link"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?tl(t[this.getStackValueField()]):"link"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series))}}const tJ={[UK.point]:{name:UK.point,type:wX.symbol},[UK.line]:{name:UK.line,type:wX.line}};class eJ extends NK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(Xi(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(Xi(h)||s.includes(l))return;a&&r.includes(l)&&(Vl(h?.type)||h?.scale||$i(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class iJ extends eJ{static type=wX.line;type=iJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===GK.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}fK.useMark([iJ,ZZ,NZ]);class nJ extends Cq{static type=GK.line;type=GK.line;_invalidType="break";static mark={...Mq.mark,...tJ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(DZ(BZ.line(t,e),LZ(UK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(DZ(BZ.symbol(),LZ(UK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}Mn(nJ,QZ);class sJ extends NK{static type=wX.rect3d;type=sJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}fK.useMark([sJ,NZ]);class rJ extends VZ{static type=GK.bar3d;type=GK.bar3d;static mark={...Mq.mark,[UK.bar3d]:{name:UK.bar3d,type:wX.rect3d}};_barMarkName=UK.bar3d;_barMarkType=wX.rect3d}function aJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===$h.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if(l()===$h.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=s(t),o=r(t);if(e===$h.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===$h.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",W$.Series)}class oJ extends pq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===$h.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class lJ extends VZ{static type=GK.rangeColumn;type=GK.rangeColumn;_barMarkType=wX.rect;_barName=GK.bar;static mark={...VZ.mark,[UK.minLabel]:{name:UK.minLabel,type:wX.text},[UK.maxLabel]:{name:UK.maxLabel,type:wX.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(lJ.mark.bar,{morph:zZ(this._spec.animation,this._spec.morph,LZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===nX.bothEnd?void 0:xn({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===nX.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(lJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(lJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===$h.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});aJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===$h.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});aJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===$h.horizontal?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===$h.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===$h.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Gh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Gh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Nl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",W$.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Nl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Gh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Gh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",W$.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(DZ(BZ.rangeColumn({direction:this.direction},e),LZ(UK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new oJ(this)}}fK.useMark([sJ]);class hJ extends lJ{static type=GK.rangeColumn3d;type=GK.rangeColumn3d;_barMarkType=wX.rect3d;_barName=GK.bar3d}class cJ extends eJ{static type=wX.area;type=cJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}fK.useMark([iJ,cJ,NZ,ZZ]);class dJ extends Cq{static type=GK.area;type=GK.area;static mark={...Mq.mark,...tJ,[UK.area]:{name:UK.area,type:wX.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(dJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===TX?this._direction===$h.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===$h.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Gh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",W$.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Gh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",W$.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(i,{curveType:e},"normal",W$.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(DZ(BZ.line(t,e),LZ(UK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(DZ(BZ.area(t,e),LZ(UK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(DZ(BZ.symbol(),LZ(UK.point,this._spec)))}}Mn(dJ,QZ);class uJ extends pq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===$h.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class pJ extends dJ{static type=GK.rangeArea;type=GK.rangeArea;static mark={...dJ.mark};initMark(){this._areaMark=this._createMark(pJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===TX?this._direction===$h.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===$h.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this)},"normal",W$.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",W$.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(i,{curveType:e},"normal",W$.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new uJ(this)}}me();const gJ={},fJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function mJ(t,e){t&&tn(t)||hl("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(gJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=me().projection(n),n.copy=n.copy||function(){const t=i();return fJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),gJ[i]||null}const yJ={albers:De,albersusa:function(){var t,e,i,n,s,r,a=De(),l=Ie().rotate([154,0]).center([-2,58.5]).parallels([55,65]),h=Ie().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){r=[t,e]}};function d(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(n.point(e,a),r)||(s.point(e,a),r)}function u(){return t=e=null,d}return d.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?l:s>=.166&&s<.234&&n>=-.214&&n<-.115?h:a).invert(t)},d.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),l.stream(i),h.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(yJ).forEach((t=>{mJ(t,yJ[t])}));const _J="Feature",vJ="FeatureCollection";function bJ(t){const e=Cn(t);return 1===e.length?e[0]:{type:vJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===vJ?t.features:Cn(t).filter((t=>!Xi(t))).map((t=>t.type===_J?t:{type:_J,geometry:t}))}(e))),[])}}const xJ=fJ.concat(["pointRadius","fit","extent","size"]);function SJ(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{xJ.includes(n)&&(i=i.concat(zN(t[n],e)))})),i):i}const wJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(Xi(i))for(let i=0;i(l(t),t)))};class AJ extends Mq{type=GK.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(Xi(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(Xi(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return Xi(r)||isNaN(r.x)||isNaN(r.y)?null:r}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Jj}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const kJ=(t,e)=>(t.features&&t.features.forEach((t=>{e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class MJ extends pq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class CJ extends NK{static type=wX.path;type=CJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var TJ,EJ,RJ;fK.useMark([CJ,NZ]),TJ="projection",EJ=class extends RW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return Xi(this.spec.pointRadius)||this.detach(zN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(zN(t,this.view)),this.commit(),this}size(t){return Xi(this.spec.size)||this.detach(zN(this.spec.size,this.view)),this.spec.size=t,this.attach(zN(t,this.view)),this.commit(),this}extent(t){return Xi(this.spec.extent)||this.detach(zN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(zN(t,this.view)),this.commit(),this}fit(t){return Xi(this.spec.fit)||this.detach(zN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(zN(t,this.view)),this.commit(),this}configure(t){return this.detach(SJ(this.spec,this.view)),Xi(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(SJ(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=mJ((t||"mercator").toLowerCase());return e||hl("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),fJ.forEach((t=>{var i,n,s;Xi(this.spec[t])||(i=this.projection,n=t,s=jN(this.spec[t],e,mJ),$i(i[n])&&i[n](s))})),Xi(this.spec.pointRadius)||this.projection.path.pointRadius(jN(this.spec.pointRadius,e,mJ)),!(Xi(this.spec.fit)||Xi(this.spec.extent)&&Xi(this.spec.size))){const t=bJ(jN(this.spec.fit,e,mJ));this.spec.extent?this.projection.fitExtent(jN(this.spec.extent,e,mJ),t):this.spec.size&&this.projection.fitSize(jN(this.spec.size,e,mJ),t)}return this.projection}output(){return this.projection}},RJ="projections",c$[TJ]={grammarClass:EJ,specKey:null!=RJ?RJ:TJ};class PJ extends AJ{static type=GK.map;type=GK.map;static mark={...Mq.mark,[UK.area]:{name:UK.area,type:wX.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),!this.map)throw new Error(`map type '${this.map}' is not specified !`);if(!QX.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),ZX(this._dataSet,"copyDataView",nK),ZX(this._dataSet,"map",kJ),ZX(this._dataSet,"lookup",wJ);const t=QX.get(this.map);if(!t)throw Error("no valid map data found!");const e=new jo(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??N$,j$],as:[this.nameField,this.valueField,this._seriesField??N$,j$]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new vq(this._option,e)}initMark(){this._pathMark=this._createMark(PJ.mark.area,{morph:zZ(this._spec.animation,this._spec.morph,LZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(PJ.mark.label,{skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>Ki(t[this._seriesField??N$])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??N$]):this._theme?.defaultFillColor,path:this.getPath.bind(this)},"normal",W$.Series),this.setMarkStyle(t,{smoothScale:!0},"normal",W$.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(DZ(BZ.path(),LZ(UK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec)))}initTooltip(){this._tooltipHelper=new MJ(this)}getPath(t){const e=this._areaCache.get(t?.properties?.[this._nameProperty]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t?.properties?.[this._nameProperty],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===wX.path?s.forEach((t=>{t.getGraphicItem().scale(e,e,i)})):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===wX.path?n.forEach((t=>{t.getGraphicItem().translate(e[0],e[1])})):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return an(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]??t.properties?.[this.nameField]??""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return t=>t?.properties?.[this._nameProperty]}}class BJ extends Mq{coordinate="polar";_outerRadius=TN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=Ki(t)?Cn(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=Ki(t)?Cn(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Cn(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(Xi(t)||Xi(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Cn(t)),n=this.radiusAxisHelper.dataToPosition(Cn(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};Nl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};Nl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),Ki(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),Ki(this._spec.radius)&&(this._outerRadius=this._spec.radius),Ki(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Vo(t.angleField,i)&&Vo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const IJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=Al(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},DJ=(t,e)=>{const i=t[0].latestData;return new OJ(e.series,i).updateLabels()};class LJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class OJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=pX(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[sN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:h}=n;if("inside"!==t?.position){const t=Tl(e.x,e.y,this._series.computeDatumRadius(s,hK.STATE_HOVER),n.middleAngle),i=Tl(e.x,e.y,this._series.computeDatumRadius(s,hK.STATE_SELECTED),n.middleAngle),a=Tl(e.x,e.y,this._series.computeDatumRadius(s,hK.STATE_NORMAL),n.middleAngle);s[pN]=a.x,s[gN]=a.y,s[dN]=t.x,s[uN]=t.y,s[vN]=i.x,s[bN]=i.y,s[fN]=l.x,s[mN]=l.y,s[yN]=h.x,s[_N]=h.y,s[aN]=r.y-o.height/2}else s[aN]=r.y;return s[iN]=this._computeAlign(n),s[eN]=Math.max(a,0),s[sN]=n.labelVisible&&!Xi(n.labelText),s[rN]=r.x,s[nN]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=Tl(e.x,e.y,f,t.middleAngle),t.labelLimit=p,Gn(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=El(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=El(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(Yn(t.pointB.x,n+r)||Gn(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?wl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?Xi(i)||"auto"===i?"edge"===n?El(t.quadrant)?"left":"right":El(t.quadrant)?"right":"left":i:Xi(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=Xi(n)||Xi(t[n])||Xi(t[s]);return $i(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class FJ extends NK{type=zJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+Cl({angle:e[xN],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class zJ extends FJ{static type=wX.arc;type=zJ.type}fK.useMark([CJ,NZ,zJ]);class HJ extends BJ{_pieMarkName=UK.pie;_pieMarkType=wX.arc;static mark={...Mq.mark,[UK.pie]:{name:UK.pie,type:wX.arc},[UK.labelLine]:{name:UK.labelLine,type:wX.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=AN;_endAngle=kN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=Ki(t),r=Ki(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(Ki(this._spec?.startAngle)?kl(this._spec.startAngle):this._startAngle,Ki(this._spec?.endAngle)?kl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=Ki(this._spec?.padAngle)?kl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;ZX(this._dataSet,"pie",IJ),ZX(this._dataSet,"arcLabel",DJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:lN,asEndAngle:hN,asRatio:oN,asMiddleAngle:xN,asRadian:wN,asQuadrant:SN,asK:cN}},!1);const e=new jo(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${Jj}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new vq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...HJ.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:zZ(this._spec.animation,this._spec.morph,LZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark(HJ.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark(HJ.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Yh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Yh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Hl(lN).bind(this),endAngle:Hl(hN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",W$.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,W$.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Hl(sN).bind(this),x:Hl(rN).bind(this),y:Hl(aN).bind(this),text:Hl(nN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Hl(iN).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[xN];return"inside"===this._spec.label?.position?Ml(e):0},limit:Hl(eN).bind(this)},void 0,W$.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Hl(sN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(L$.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return t?.outerRadius&&(e.outerRadius=()=>this.computeLayoutRadius()*t?.outerRadius),t?.innerRadius&&(e.innerRadius=()=>this.computeLayoutRadius()*t?.innerRadius),t?.cornerRadius&&(e.cornerRadius=()=>this.computeLayoutRadius()*t?.cornerRadius),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${Jj}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${Jj}_ARC_LABEL_${e}_AY`])} L${Math.round(t[fN])},${Math.round(t[mN])} L${Math.round(t[yN])},${Math.round(t[_N])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(Xi(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[xN];if(Xi(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=Cl({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[xN];if(Xi(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=Cl({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===oK.appear)return this._startAngle;if(i===oK.disappear)return this._endAngle;const n=[oK.disappear,oK.exit],s=e.mark.elements,r=t,a=r?.[H$];if(void 0===s.find((t=>t.data[0]?.[H$]t.data[0]?.[H$]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[H$]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Cl({angle:e[xN],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Cl({angle:e[xN],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Cl({angle:e[xN],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Cl({angle:e[xN],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class jJ extends HJ{static type=GK.pie;type=GK.pie}class NJ extends FJ{static type=wX.arc3d;type=NJ.type}fK.useMark([CJ,NZ,NJ]);class VJ extends HJ{static type=GK.pie3d;type=GK.pie3d;_pieMarkName=UK.pie3d;_pieMarkType=wX.arc3d;static mark={...Mq.mark,[UK.pie3d]:{name:UK.pie3d,type:wX.arc3d},[UK.labelLine]:{name:UK.labelLine,type:wX.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Hl(lN).bind(this),endAngle:Hl(hN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",W$.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,W$.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Hl(rN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Hl(aN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Hl(sN).bind(this),x:Hl(rN).bind(this),y:Hl(aN).bind(this),text:Hl(nN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Hl(iN).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[xN];return"inside"===this._spec.label?.position?Ml(e):0},limit:Hl(eN).bind(this),...n},void 0,W$.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Hl(sN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const WJ=[10,20],UJ=jl.Linear,GJ="circle",YJ=jl.Ordinal,$J=["circle","square","triangle","diamond","star"];fK.useMark([ZZ,NZ]);class XJ extends Cq{static type=GK.scatter;type=GK.scatter;static mark={...Mq.mark,[UK.point]:{name:UK.point,type:wX.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if($i(e))return e;if(en(e)){if(Xi(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${Jj}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(qi(e)){if(Xi(t))throw new Error(`${s}Field is required.`);const r={id:`${Jj}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return Xi(e)?10:rn(e)?e:!tn(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:UJ,defaultRange:WJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return Xi(e)?GJ:tn(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:YJ,defaultRange:$J},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(XJ.mark.point,{morph:zZ(this._spec.animation,this._spec.morph,LZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:xn({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(DZ(BZ.scatter({},t),LZ(UK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:rn(this._size)||$i(this._size)?this._size:10,shape:tn(this._shape)||$i(this._shape)?this._shape:GJ},hK.STATE_NORMAL,W$.Series),(Ki(this._sizeField)||Ki(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},hK.STATE_NORMAL,W$.User_Mark),(Ki(this._shapeField)||Ki(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},hK.STATE_NORMAL,W$.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},hK.STATE_NORMAL,W$.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class KJ extends BJ{getStackGroupFields(){return this._angleField}getStackValueField(){return Cn(this._spec.valueField)[0]||Cn(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(G$),this.setInnerRadiusField(U$)}setValueFieldToPercent(){this.setRadiusField($$),this.setInnerRadiusField(Y$)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}fK.useMark([zJ,NZ]);class qJ extends KJ{static type=GK.rose;type=GK.rose;static mark={...VZ.mark,[UK.rose]:{name:UK.rose,type:wX.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(qJ.mark.rose,{morph:zZ(this._spec.animation,this._spec.morph,LZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(qJ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Gh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Gh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Gh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(Ml(e)??0)+90},void 0,W$.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(DZ(BZ.rose(e,t),LZ(UK.rose,this._spec)))}}}fK.useMark([cJ,iJ,ZZ,NZ]);class ZJ extends KJ{static type=GK.radar;type=GK.radar;static mark={...Mq.mark,...tJ,[UK.area]:{name:UK.area,type:wX.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(ZJ.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:EX},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:kl(this._spec.startAngle)??AN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(DZ(BZ.radarGroup(t,e),LZ(UK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(Ki(i)){const s=BZ[n];i.setAnimationConfig(DZ(s(t,e),LZ(i.name,this._spec)))}}))}}Mn(ZJ,QZ);class JJ extends pq{updateTooltipSpec(){super.updateTooltipSpec(),Ki(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>No.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const QJ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},tQ={fill:"#bbb",fillOpacity:.2};fK.useMark([ZZ,NZ,WZ,jZ]);class eQ extends Cq{static type=GK.dot;type=GK.dot;static mark={...Mq.mark,[UK.group]:{name:UK.group,type:wX.group},[UK.grid]:{name:UK.grid,type:wX.rule},[UK.gridBackground]:{name:UK.gridBackground,type:wX.rect},[UK.dot]:{name:UK.dot,type:wX.symbol},[UK.title]:{name:UK.title,type:wX.text},[UK.subTitle]:{name:UK.subTitle,type:wX.text},[UK.symbol]:{name:UK.symbol,type:wX.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){Ki(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){Ki(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){Ki(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){Ki(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){Ki(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){Ki(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),ZX(this._option.dataSet,"objFlat",QJ),ZX(this._option.dataSet,"copyDataView",nK),JX(this._option.dataSet,"dataview",Lo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){Ki(t)&&(this._seriesField=t,this.getMarksInType([wX.line,wX.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(xn(tQ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(eQ.mark.group),this._containerMark=this._createMark(eQ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(eQ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(eQ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(eQ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(eQ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(eQ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(eQ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",W$.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",W$.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",W$.Series),this._trigger.registerMark(i));const n=this._gridMark;n&&(this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",W$.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",W$.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",W$.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",W$.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(o))}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??N$}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Oh(this._option.getTheme().colorScheme,this.type);return(new Vh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??N$}}initTooltip(){this._tooltipHelper=new JJ(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class iQ extends pq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>No.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}fK.useMark([WZ,ZZ]);class nQ extends Cq{static type=GK.link;type=GK.link;static mark={...Mq.mark,[UK.group]:{name:UK.group,type:wX.group},[UK.link]:{name:UK.link,type:wX.rule},[UK.arrow]:{name:UK.arrow,type:wX.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){Ki(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){Ki(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){Ki(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){Ki(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();ZX(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(nQ.mark.group),this._containerMark=this._createMark(nQ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(nQ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(nQ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",W$.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",W$.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",W$.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?RX.triangleDown:RX.triangleUp},"normal",W$.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??N$}}initTooltip(){this._tooltipHelper=new iQ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class sQ extends BJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=kl(this._spec.startAngle)??kl(t?.startAngle)??AN,this._endAngle=kl(this._spec.endAngle)??kl(t?.endAngle)??kN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||Ki(n?.startAngle)||Ki(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Gh(this.angleAxisHelper.dataToPosition([t[U$]]),this.angleAxisHelper.getScale(0));if(an(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Gh(this.angleAxisHelper.dataToPosition([t[G$]]),this.angleAxisHelper.getScale(0));if(an(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class rQ extends FJ{static type=wX.arc;static constructorType=wX.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){Ki(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),Ki(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const l=Ki(t.innerPadding)&&Ki(a)||Ki(t.outerPadding)&&Ki(o),h=Ki(t.innerRadius)&&s||Ki(t.outerRadius)&&r;if(l||h){const e=Object.assign({},t);return s&&Ki(a)&&($i(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+($i(s)?s(t,e,i,n):s):$i(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&Ki(o)&&($i(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-($i(r)?r(t,e,i,n):r):$i(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}fK.useMark([zJ,rQ]);class aQ extends sQ{static type=GK.circularProgress;type=GK.circularProgress;static mark={...Mq.mark,[UK.track]:{name:UK.track,type:wX.progressArc},[UK.progress]:{name:UK.progress,type:wX.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(aQ.mark.track),this._progressMark=this._createMark(aQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(an(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(an(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(DZ(BZ.circularProgress({startAngle:this._startAngle},t),LZ(UK.progress,this._spec))),this._trackMark.setAnimationConfig(DZ(BZ.progressBackground(),LZ(UK.track,this._spec)))}}class oQ extends pq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}fK.useMark([jZ]);class lQ extends Cq{static type=GK.linearProgress;type=GK.linearProgress;static mark={...Mq.mark,[UK.track]:{name:UK.track,type:wX.rect},[UK.progress]:{name:UK.progress,type:wX.rect},[UK.group]:{name:UK.group,type:wX.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(lQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Gh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Gh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Gh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Gh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(lQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Gh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Gh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(lQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Gh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(uB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Gh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(uB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",W$.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(DZ(BZ.linearProgress(t,e),LZ(UK.progress,this._spec))),this._trackMark.setAnimationConfig(DZ(BZ.progressBackground(),LZ(UK.track,this._spec)))}initTooltip(){this._tooltipHelper=new oQ(this)}}const hQ=[0],cQ=[20,40],dQ=[200,500],uQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},pQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],gQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:fQ,triangle:fQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function fQ(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function mQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const yQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function _Q(t){return $i(t)?t:function(){return t}}class vQ{constructor(t){var e,i;switch(this.options=Object.assign({},vQ.defaultOptions,t),$i(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>gQ[t]?gQ[t]():gQ.circle())(this.options.shape),this.getText=null!==(e=_Q(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=_Q(this.options.fontWeight),this.getTextFontSize=_Q(this.options.fontSize),this.getTextFontStyle=_Q(this.options.fontStyle),this.getTextFontFamily=_Q(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>yQ(10,50);break;case"random-light":this.getTextColor=()=>yQ(50,90);break;default:this.getTextColor=_Q(this.options.color)}if(Xi(this.options.rotate)){if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}}else this.getTextRotate=$i(this.options.rotate)?t=>{var e;return Es(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Es(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!Xi(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class xQ extends vQ{constructor(t){var e;super(Object.assign({},xQ.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.spiral=tn(this.options.spiral)?null!==(e=bQ[this.options.spiral])&&void 0!==e?e:bQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=_Q(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:n}=mQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));for(this.data=r;s>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(kQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(AQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}kQ(p,this._size)&&(p=MQ(p,this._size))}else if(kQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||wQ(p,i))&&(!i||!SQ(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function SQ(t,e,i){const n=i[0]>>5,s=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function wQ(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,kQ=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function MQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),Pn(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=mQ(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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(;ie.left+e.width||t.top>e.top+e.height)}TQ.defaultOptions={enlarge:!1};const RQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},PQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?BQ(t.fontFamily):"sans-serif",u=t.fontStyle?BQ(t.fontStyle):"normal",p=t.fontWeight?BQ(t.fontWeight):"normal",g=t.rotate?BQ(t.rotate):0,f=BQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?BQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",v=null!==(r=t.shrink)&&void 0!==r&&r,b=null!==(a=t.enlarge)&&void 0!==a&&a,x=null!==(o=t.clip)&&void 0!==o&&o,S=null!==(l=t.minFontSize)&&void 0!==l?l:0,w=t.randomVisible,A=t.as||RQ,k=t.depth_3d,M=t.postProjection;let C=t.fontSize?BQ(t.fontSize):14;const T=t.fontSizeRange;if(T&&!rn(C)){const t=C;C=e=>IQ(t(e),DQ(t,h),T)}let E=xQ;"fast"===t.layoutType?E=TQ:"grid"===t.layoutType&&(E=CQ);const R=new E({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:C,shrink:v,clip:x,enlarge:b,minFontSize:S,random:w,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},BQ=t=>tn(t)||rn(t)||$i(t)?t:e=>e[t.field],IQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],DQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function LQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),zQ=(t,e)=>{let i=0;for(const e of t)FQ(e)?i+=1:i+=.53;return i};function HQ(t){return on(t)?new Promise(((e,i)=>{const n=mB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{ll().error("image 加载失败!",t)}})):null}var jQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function NQ(t){return jQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield HQ(e);r&&(a=yield function(t,e,i){return jQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&WQ(s,n,a-1);)--a;for(;oo&&UQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield HQ(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||VQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function VQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function WQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=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")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||XQ(e,t,r)))return $Q(e,t,r),!0}return!1}function $Q(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function XQ(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function KQ(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(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,s,u).data;let f,m;for(;--n>=p;){const t=i[n];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;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(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 qQ(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=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++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=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?GQ(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=qQ(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return GQ(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){KQ(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!XQ(i,y,_)&&($Q(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var QQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const t0={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},e0=(t,e,i,n)=>QQ(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||hl("WordcloudShape shape must be specified."),t.text||hl("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(OQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||t0;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=yj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield NQ(l),p=t.colorMode||"ordinal",g={getText:a0(t.text),getFontSize:a0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?a0(t.colorField):a0(t.text),getFillingColor:a0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:a0(t.colorHexField),getFontFamily:a0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:a0(t.padding||1),getFontStyle:a0(t.fontStyle||"normal"),getFontWeight:a0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?a0(t.fontOpacity):()=>1};n0(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:a0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:a0(t.fillingFontStyle||"normal"),getFillingFontWeight:a0(t.fillingFontWeight||"normal"),getFillingPadding:a0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((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{const i=zQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,R=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),P=Math.max(...R.map((t=>t.fontSize)));R.forEach((t=>t.weight=t.fontSize/P)),R.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield JQ(R,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(OQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),i0=(t,e,i,n)=>{var s,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 Yl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Yl).domain(e).range(f).scale(t)}}else(new xh).domain(r0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new xh).domain(r0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},n0=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new Eh).domain(r0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&$i(s)&&!n){const e=.5,[o,l]=(i.shapeArea,r0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=s0(h,i,!0);n=[~~(e*c),~~c];const d=(new Eh).domain(r0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=s0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},s0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=zQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},a0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:$i(t)?t:e=>e[t.field]:null,o0=`${Jj}_WORD_CLOUD_ANGLE`,l0=`${Jj}_WORD_CLOUD_FILLING_ANGLE`,h0=`${Jj}_WORD_CLOUD_WEIGHT`,c0=`${Jj}_WORD_CLOUD_TEXT`;fK.useMark([NZ]),PN("wordcloud",{transform:PQ,markPhase:"beforeJoin"},!0),PN("wordcloudShape",{transform:e0,markPhase:"beforeJoin"},!0);class d0 extends Mq{static mark={...Mq.mark,[UK.word]:{name:UK.word,type:wX.text},[UK.fillingWord]:{name:UK.fillingWord,type:wX.text}};_nameField;_valueField;setValueField(t){Ki(t)&&(this._valueField=t,this.setFontSizeRange(cQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){Ki(t)&&Ki(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??dQ,this._rotateAngles=this._spec.rotateAngles??hQ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:uQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:hQ,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!pQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(d0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(d0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?c0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",W$.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(DZ(BZ.wordCloud(),LZ(UK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Oh(this._option.getTheme().colorScheme,this.type);return(new Vh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??N$};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new xh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=yl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:h0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:o0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:l0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:c0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?c0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:j$,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?c0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:Ko(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:j$,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:o0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class u0 extends d0{static type=GK.wordCloud;type=GK.wordCloud}class p0 extends d0{static type=GK.wordCloud3d;type=GK.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new xh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=yl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:h0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:o0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:l0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:c0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?c0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:j$,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:j$,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:o0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(d0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(d0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",W$.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(DZ(BZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),LZ(UK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(DZ(BZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),LZ(UK.fillingWord,this._spec)))}}const g0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=an(y*f)?y/f:null,b=an(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:b),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},f0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},m0=`${Jj}_FUNNEL_TRANSFORM_RATIO`,y0=`${Jj}_FUNNEL_REACH_RATIO`,_0=`${Jj}_FUNNEL_HEIGHT_RATIO`,v0=`${Jj}_FUNNEL_VALUE_RATIO`,b0=`${Jj}_FUNNEL_LAST_VALUE_RATIO`,x0=`${Jj}_FUNNEL_NEXT_VALUE_RATIO`,S0=`${Jj}_FUNNEL_LAST_VALUE`,w0=`${Jj}_FUNNEL_CURRENT_VALUE`,A0=`${Jj}_FUNNEL_NEXT_VALUE`,k0=`${Jj}_FUNNEL_TRANSFORM_LEVEL`,M0=20;class C0 extends pq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===UK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===UK.transform){const e=t?.[y0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===UK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return Ki(n[0])?t?.[n[0]]:t?.[s]}}class T0 extends NK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class E0 extends T0{static type=wX.polygon;type=E0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}fK.useMark([E0,NZ,WZ]);class R0 extends Mq{static type=GK.funnel;type=GK.funnel;_funnelMarkName=UK.funnel;_funnelMarkType=wX.polygon;_transformMarkName=UK.transform;_transformMarkType=wX.polygon;static mark={...Mq.mark,[UK.funnel]:{name:UK.funnel,type:wX.polygon},[UK.transform]:{name:UK.transform,type:wX.polygon},[UK.transformLabel]:{name:UK.transformLabel,type:wX.text},[UK.outerLabel]:{name:UK.outerLabel,type:wX.text},[UK.outerLabelLine]:{name:UK.outerLabelLine,type:wX.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",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._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;ZX(this._dataSet,"funnel",g0),ZX(this._dataSet,"funnelTransform",f0);const t=new jo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Jj}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new vq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:w0,asTransformRatio:m0,asReachRatio:y0,asHeightRatio:_0,asValueRatio:v0,asNextValueRatio:x0,asLastValueRatio:b0,asLastValue:S0,asNextValue:A0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:k0}})}initMark(){if(this._funnelMark=this._createMark({...R0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:zZ(this._spec.animation,this._spec.morph,LZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...R0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(R0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(R0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(R0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(R0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new C0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>Ki(t[this._valueField]),fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",W$.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Hl(y0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",W$.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",W$.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",W$.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(DZ(BZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),LZ(UK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(DZ(BZ.funnel({},t),LZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(DZ(BZ.label(),LZ(UK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[b0])/2:this._getSecondaryAxisLength(t[v0])/2,s=this._getSecondaryAxisLength(t[v0])/2):(n=this._getSecondaryAxisLength(t[v0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[x0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[k0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return Ki(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!Ki(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(rn(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-M0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",W$.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",W$.Series)}}function I0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==s?void 0:s.key)&&void 0!==h?h:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=O0(t.children,d.children,i+1,o,d,r);d.value=Xi(t.value)?e.sum:Math.max(e.sum,d.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=Xi(t.value)?0:t.value;a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},F0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=F0(t.children,e,t,s))})),n},z0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=z0(t.children,e,t,s)),s=e(t,n,i,s)})),s},H0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:I0,slice:D0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?D0:I0)(t,e,i,n,s)}};class j0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},j0.defaultOpionts,t);const i=this.options.nodeKey,n=$i(i)?i:i?dl(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?L0(this.options.aspectRatio):null!==(e=H0[this.options.splitType])&&void 0!==e?e:H0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},s=[],r=O0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(rn(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(rn(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}j0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const N0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class V0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];I0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),N0);const n=en(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],n)return this._layoutLabel(t,Yi(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},V0.defaultOpionts,t):Object.assign({},V0.defaultOpionts);const e=this.options.nodeKey,i=$i(e)?e:e?dl(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+vl(this.options.center[0],t.width),n=t.y0+vl(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=en(r),l=o?r.map((t=>vl(t,s))):vl(r,s),h=en(a),c=this.options.gapRadius,d=h?a.map((t=>vl(t,s))):vl(a,s),u=Bn(0,e+1);if(o)this._parsedInnerRadius=u.map(((t,e)=>{const i=l[e];return Xi(i)?s:i})),this._parsedOutterRadius=u.map(((t,i)=>{var n;return h?d[i]:iXi(d[e])?s:d[e])),this._parsedInnerRadius=u.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(en(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=vl(r,s),i=(d-t)/(e+1);this._parsedInnerRadius=u.map(((e,n)=>t+n*i)),this._parsedOutterRadius=u.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(en(c)?null!==(n=c[e])&&void 0!==n?n:0:c)}))}this._parsedCenter=[i,n],this._maxRadius=s}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],s=O0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Is({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}V0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const W0=4294967296;function U0(t,e){let i,n;if($0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function $0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function Z0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function J0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function Q0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function t1(t){return{_:t,next:null,prev:null}}function e1(t,e){const i=(t=Cn(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];Z0(s,n,r);let a,o,l,h,c,d,u,p=t1(n),g=t1(s),f=t1(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:en(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const l=[],h=O0(t,l,0,-1,null,this._getNodeKey);this._maxDepth=h.maxDepth;const c=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%W0)/W0}(),d={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:h.sum,datum:null,children:l,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=$i(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:r1.defaultOpionts.nodeSort;F0([d],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)F0([d],i1(this.options.setRadius)),z0([d],n1(this._getPadding,.5,c)),F0([d],s1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);F0([d],i1(r1.defaultOpionts.setRadius)),z0([d],n1(pl,1,c)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&z0([d],n1(this._getPadding,d.radius/t,c)),F0([d],s1(t/(2*d.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[d]:l}}r1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const a1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):a1(t.children,e,i)))})),e},o1=(t,e={})=>{if(!t)return[];const i=[];return a1(t,i,e),i},l1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new V0(i).layout(t,{width:n,height:s})};class h1 extends pq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var c1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(c1||(c1={}));const d1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(Xi(s))return t;if(i.type===c1.DrillDown){return Cn(_X(t,s,n,"children"))}if(i.type===c1.DrillUp){const e=vX(t,s,n,"children");if(e)return Cn(e)}return t};class u1{pointerId;parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}parserDragEvent(){return!0}}class p1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!0)}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}}const g1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:u1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:u1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:p1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:p1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:p1}};class f1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return g1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===n.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;ZX(t,"drillFilter",d1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(Xi(t.datum)||Xi(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!en(t)||un(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:c1.DrillDown},e().reRunAllTransform(),i.emit(L$.drill,{value:{path:t,type:c1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!en(i)||un(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:c1.DrillUp},t().reRunAllTransform(),e.emit(L$.drill,{value:{path:i,type:c1.DrillUp},model:this}),i}}fK.useMark([zJ,NZ]);class m1 extends BJ{static type=GK.sunburst;type=GK.sunburst;static mark={...Mq.mark,[UK.sunburst]:{name:UK.sunburst,type:wX.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??xq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??j$,getRawData:()=>this.getRawData()}),this._startAngle=Es(this._spec.startAngle),this._endAngle=Es(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),ZX(this._dataSet,"sunburstLayout",l1),ZX(this._dataSet,"flatten",o1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[Ki(this._centerX)?this._centerX:this.getLayoutRect().width/2,Ki(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:bq,operations:["max","min","values"]},{key:xq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();Xi(t?.dataSet)||(ZX(t.dataSet,"addVChartProperty",nq),t.transform({type:"addVChartProperty",options:{beforeCall:wq,call:kq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(m1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){Xi(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(Ki(this._offsetX)?this._offsetX:0),y:t=>t.y+(Ki(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},hK.STATE_NORMAL,W$.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(m1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){Xi(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return qi(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(Ki(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(Ki(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},hK.STATE_NORMAL,W$.Series)}initTooltip(){this._tooltipHelper=new h1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(Cn(this.__innerRadius))[0],outerRadius:this._computeRadius(Cn(this.__outerRadius))[0],startAngle:Cn(this._startAngle)[0],endAngle:Cn(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(wX.arc).forEach((i=>{i.setAnimationConfig(DZ(BZ.sunburst(t,e),LZ(i.name,this._spec)))})),this.getMarksInType(wX.text).forEach((t=>{t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(en(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}Mn(m1,f1);const y1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new r1(i).layout(t,{width:n,height:s})};class _1 extends pq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}fK.useMark([zJ,NZ]);class v1 extends Cq{static type=GK.circlePacking;type=GK.circlePacking;static mark={...Mq.mark,[UK.circlePacking]:{name:UK.circlePacking,type:wX.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??xq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??j$,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();Xi(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),ZX(this._dataSet,"circlePackingLayout",y1),ZX(this._dataSet,"flatten",o1),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{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();Xi(t?.dataSet)||(ZX(t.dataSet,"addVChartProperty",nq),t.transform({type:"addVChartProperty",options:{beforeCall:wq,call:kq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(v1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){Xi(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},hK.STATE_NORMAL,W$.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(v1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){Xi(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},hK.STATE_NORMAL,W$.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:bq,operations:["max","min","values"]},{key:xq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new _1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(wX.arc).forEach((e=>{e.setAnimationConfig(DZ(BZ.circlePacking({},t),LZ(e.name,this._spec)))})),this.getMarksInType(wX.text).forEach((t=>{t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}Mn(v1,f1);const b1=t=>{let e=0;return t.forEach(((t,i)=>{var n;Xi(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=b1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function x1(t){return t.depth}function S1(t,e){return e-1-t.endDepth}const w1=(t,e)=>t.y0-e.y0,A1={left:x1,right:S1,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?En(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:x1,end:S1};class k1{constructor(t){this._ascendingSourceBreadth=(t,e)=>w1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>w1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},k1.defaultOptions,t);const e=this.options.nodeKey,i=$i(e)?e:e?dl(e):null;this._getNodeKey=i,this._alignFunc=$i(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):A1[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];b1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(Xi(s.source)||Xi(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&hl("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&hl("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(tn(e)){const t=Kn(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(rn(e)){if(r=e,rn(i))a=i;else if(Xi(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else $i(e)&&rn(i)&&(a=i);const l=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}Xi(this.options.nodeSortBy)&&s.sort(w1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(w1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new k1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},C1=(t,e)=>{if(!t||!e?.view||!en(t))return t;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 t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new k1(e),s=[];return s.push(n.layout(t,i)),s},T1=t=>t&&en(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],E1=t=>t&&en(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class R1 extends pq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(rn(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class P1 extends NK{static type=wX.linkPath;type=P1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){ZN("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(lW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),QV("linkPathGrowIn",hW),QV("linkPathGrowOut",cW),QV("linkPathUpdate",dW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}fK.useMark([jZ,P1,NZ]),PN("sankey",{transform:M1,markPhase:"beforeJoin"},!0);class B1 extends Cq{static type=GK.sankey;type=GK.sankey;static mark={...VZ.mark,[UK.node]:{name:UK.node,type:wX.rect},[UK.link]:{name:UK.link,type:wX.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=J$.Node;_labelLayoutZIndex=J$.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Cs;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){ZX(this._dataSet,"sankey",C1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new zo;JX(t,"dataview",Lo),ZX(t,"sankeyNodes",T1),ZX(t,"addVChartProperty",nq);const e=new jo(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1),this._nodesSeriesData=new vq(this._option,e);const i=new zo;JX(i,"dataview",Lo),ZX(i,"sankeyLinks",E1),ZX(i,"addVChartProperty",nq);const n=new jo(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1),this._linksSeriesData=new vq(this._option,n)}}initMark(){const t=this._createMark(B1.mark.node,{isSeriesMark:!0,key:H$,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(B1.mark.link,{key:H$,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(B1.mark.label,{key:H$,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},hK.STATE_NORMAL,W$.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},hK.STATE_NORMAL,W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},hK.STATE_NORMAL,W$.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(DZ(BZ.sankeyNode(t,e),LZ(UK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(DZ(BZ.sankeyLinkPath(),LZ(UK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:F$.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:F$.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:F$.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:F$.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(Cn(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||Cn(s[r]).includes(e.source)&&Cn(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(Cn(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new R1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Oh(this._option.getTheme().colorScheme,this.type),n=new Vh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const I1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new j0(e).layout(t,i)},D1=(t,e)=>{let i={},n=e.fields;if($i(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=o1(s);return i=yq([{latestData:r}],e),i};class L1 extends pq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class O1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,g1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return g1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:F$.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:F$.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;Xi(s)||Kh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){g1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){g1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){g1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){g1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:F$.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:F$.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;Xi(s)&&Xi(r)||Kh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:F$.chart},(t=>{if(!t.event)return;const{event:n}=t;Kh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:F$.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){g1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:F$.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){g1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:F$.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:F$.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:F$.chart,source:O$.chart},l),this._eventObj.off(n,{level:F$.chart,source:O$.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:F$.chart,source:O$.chart},l),this._eventObj.on(n,{level:F$.chart,source:O$.chart},o)}}fK.useMark([jZ,NZ]);class F1 extends Cq{static type=GK.treemap;type=GK.treemap;static mark={...Mq.mark,[UK.nonLeaf]:{name:UK.nonLeaf,type:wX.rect},[UK.leaf]:{name:UK.leaf,type:wX.rect},[UK.nonLeafLabel]:{name:UK.nonLeafLabel,type:wX.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Cs;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??xq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ls),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??j$,getRawData:()=>this.getRawData()}),an(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),ZX(this._dataSet,"treemap",I1),ZX(this._dataSet,"flatten",o1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(ZX(this._rawData.dataSet,"addVChartProperty",nq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:wq,call:kq.bind(this)}}))}_statisticRawData(){const t=`${Jj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){ZX(this._dataSet,"hierarchyDimensionStatistics",D1),ZX(this._dataSet,"flatten",o1);const i=new jo(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 super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:bq,operations:["max","min","values"]},{key:xq,operations:["values"]}])}initMark(){const t=this._createMark(F1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(F1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(F1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(F1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},hK.STATE_NORMAL,W$.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()},hK.STATE_NORMAL,W$.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},hK.STATE_NORMAL,W$.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},hK.STATE_NORMAL,W$.Series)}initAnimation(){this.getMarksInType(wX.rect).forEach((t=>{t.setAnimationConfig(DZ(BZ.treemap(),LZ(t.name,this._spec)))})),this.getMarksInType(wX.text).forEach((t=>{t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))}))}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 L1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(uV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(uV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}Mn(F1,O1),Mn(F1,f1),fK.useMark([CJ,jZ]);class z1 extends sQ{static type=GK.gaugePointer;type=GK.gaugePointer;static mark={...Mq.mark,[UK.pin]:{name:UK.pin,type:wX.path},[UK.pinBackground]:{name:UK.pinBackground,type:wX.path},[UK.pointer]:{name:UK.pointer,type:[wX.path,wX.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?wX.rect:wX.path}initMark(){this._pinBackgroundMark=this._createMark(z1.mark.pinBackground),this._pointerMark=this._createMark({...z1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(z1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===wX.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return Ki(this.radiusAxisHelper)&&Ki(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(DZ(BZ.circularProgress({startAngle:this._startAngle},t),LZ(UK.pointer,this._spec)))}}fK.useMark([rQ]);class H1 extends sQ{static type=GK.gauge;type=GK.gauge;static mark={...Mq.mark,[UK.segment]:{name:UK.segment,type:wX.progressArc},[UK.track]:{name:UK.track,type:wX.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=kl(this._spec.padAngle??0)}initData(){super.initData();ZX(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[Z$]=t[this._angleField[0]],t[q$]=e>0?i[e-1][Z$]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(H1.mark.track),this._segmentMark=this._createMark(H1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(Ki(t[q$])?this.angleAxisHelper.dataToPosition([t[q$]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[Z$]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(DZ(BZ.circularProgress({startAngle:this._startAngle},t),LZ(UK.segment,this._spec)))}}class j1 extends pq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return Ki(i)&&"dimension"===t&&(i.visible=!1),i}}class N1 extends qZ{static type=wX.cell;type=N1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}fK.useMark([N1,NZ]);class V1 extends Cq{static type=GK.heatmap;type=GK.heatmap;static mark={...Mq.mark,[UK.cell]:{name:UK.cell,type:wX.cell},[UK.cellBackground]:{name:UK.cellBackground,type:wX.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Cn(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(V1.mark.cell,{morph:zZ(this._spec.animation,this._spec.morph,LZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:xn({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(V1.mark.cellBackground,{progressive:t})}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",W$.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=Tr(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",W$.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(DZ(BZ.heatmap(t),LZ(UK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new j1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}fK.useSeries([dJ]);class W1 extends qK{static type=YK.area;static view="singleDefault";type=YK.area;seriesType=GK.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([VZ]);class U1 extends qK{static type=YK.bar;static view="singleDefault";type=YK.bar;seriesType=GK.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([rJ]);class G1 extends qK{static type=YK.bar3d;static view="singleDefault";type=YK.bar3d;seriesType=GK.bar3d}fK.useSeries([JZ]);class Y1 extends qK{static type=YK.boxPlot;static view="singleDefault";type=YK.boxPlot;seriesType=GK.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??$h.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===$h.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),ZK(t)}}fK.useSeries([v1]);class $1 extends KK{static type=YK.circlePacking;static view="singleDefault";type=YK.circlePacking;seriesType=GK.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=GK.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class X1 extends KK{static type=YK.common;static view="singleDefault";type=YK.common}class K1 extends KK{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([R0]);class q1 extends K1{static type=YK.funnel;static view="singleDefault";type=YK.funnel;seriesType=GK.funnel}fK.useSeries([B0]);class Z1 extends K1{static type=YK.funnel3d;static view="singleDefault";type=YK.funnel3d;seriesType=GK.funnel3d}const J1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Q1(t){let e=0;return pn(t,"tick.visible")&&(e+=pn(t,"tick.tickSize")),pn(t,"label.visible")&&(e+=pn(t,"label.space")),e}function t2(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function e2(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function i2(t){const e=t?.orient;return"angle"===e||"radius"===e}const n2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return xn({},o,("band"===e?n:"linear"===e?s:{})??{},BX(t)?r:a)},s2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return xn({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class r2 extends KK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=Cn(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return Ki(i)&&e.forEach((t=>{Xi(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],Ki(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class a2 extends r2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),Xi(n.angle.type)&&(n.angle.type="linear"),Xi(n.radius.type)&&(n.radius.type="band");const s=t2(n.angle,{min:0,max:1});Xi(n.angle.min)&&(n.angle.min=s.min),Xi(n.angle.max)&&(n.angle.max=s.max)}}fK.useSeries([z1,H1]);class o2 extends a2{static type=YK.gauge;static view="singleDefault";type=YK.gauge;seriesType=GK.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:GK.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===GK.gauge||t.type===GK.circularProgress));Xi(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&Xi(e.radiusField)&&Xi(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===GK.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),Xi(e.angle.type)&&(e.angle.type="linear"),Xi(e.radius.type)&&(e.radius.type="linear")}}fK.useSeries([V1]);class l2 extends qK{static type=YK.heatmap;static view="singleDefault";type=YK.heatmap;seriesType=GK.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class h2 extends qK{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}fK.useSeries([VZ]);class c2 extends h2{static type=YK.histogram;static view="singleDefault";type=YK.histogram;seriesType=GK.bar;transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([rJ]);class d2 extends h2{static type=YK.histogram3d;static view="singleDefault";type=YK.histogram3d;seriesType=GK.bar3d}fK.useSeries([nJ]);class u2 extends qK{static type=YK.line;static view="singleDefault";type=YK.line;seriesType=GK.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([PJ]);class p2 extends KK{static type=YK.map;static view="singleDefault";type=YK.map;seriesType=GK.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area}}isValidSeries(t){return t===GK.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class g2 extends r2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}fK.useSeries([jJ]);class f2 extends g2{static type=YK.pie;static view="singleDefault";type=YK.pie;seriesType=GK.pie}fK.useSeries([VJ]);class m2 extends g2{static type=YK.pie3d;static view="singleDefault";type=YK.pie3d;seriesType=GK.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}fK.useSeries([aQ]);class y2 extends a2{static type=YK.circularProgress;static view="singleDefault";type=YK.circularProgress;seriesType=GK.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}fK.useSeries([lQ]);class _2 extends qK{static type=YK.linearProgress;static view="singleDefault";type=YK.linearProgress;seriesType=GK.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),Xi(i.type)&&(i.type="band"),Xi(e.type)&&(e.type="linear");const n=t2(e,{min:0,max:1});Xi(e.min)&&(e.min=n.min),Xi(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),Xi(i.type)&&(i.type="linear"),Xi(e.type)&&(e.type="band");const n=t2(i,{min:0,max:1});Xi(i.min)&&(i.min=n.min),Xi(i.max)&&(i.max=n.max)}}}class v2 extends r2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}fK.useSeries([ZJ]);class b2 extends v2{static type=YK.radar;static view="singleDefault";type=YK.radar;seriesType=GK.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:xn({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=Cn(t.crosshair||{}).map((t=>xn({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}fK.useSeries([pJ]);class x2 extends qK{static type=YK.rangeArea;static view="singleDefault";type=YK.rangeArea;seriesType=GK.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===$h.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([lJ]);class S2 extends qK{static type=YK.rangeColumn;static view="singleDefault";type=YK.rangeColumn;seriesType=GK.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===$h.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([hJ]);class w2 extends qK{static type=YK.rangeColumn3d;static view="singleDefault";type=YK.rangeColumn3d;seriesType=GK.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===$h.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}fK.useSeries([qJ]);class A2 extends v2{static type=YK.rose;static view="singleDefault";type=YK.rose;seriesType=GK.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??TN,outerRadius:t.outerRadius??TN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=Cn(t.crosshair||{}).map((t=>xn({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}fK.useSeries([B1]);class k2 extends KK{static type=YK.sankey;static view="singleDefault";type=YK.sankey;seriesType=GK.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([XJ]);class M2 extends qK{static type=YK.scatter;static view="singleDefault";type=YK.scatter;seriesType=GK.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}fK.useSeries([eQ,nQ]);class C2 extends KK{static type=YK.sequence;static view="singleDefault";type=YK.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==GK.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[GK.bar,GK.line,GK.area,GK.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===GK.dot?"band":"linear",visible:t.type!==GK.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===GK.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===GK.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=rK(t.data,this._dataSet,this._spec.data),t.type===GK.link&&(t.dataDot=rK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===GK.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===GK.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=AX.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}fK.useSeries([m1]);class T2 extends KK{static type=YK.sunburst;static view="singleDefault";type=YK.sunburst;seriesType=GK.sunburst;getDefaultSeriesSpec(t){const e=Ki(t.startAngle)?t.startAngle:MN,i=Ki(t.endAngle)?t.endAngle:e+Rs(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=GK.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([F1]);class E2 extends KK{static type=YK.treemap;static view="singleDefault";type=YK.treemap;seriesType=GK.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([UZ]);class R2 extends U1{static type=YK.waterfall;static view="singleDefault";type=YK.waterfall;seriesType=GK.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&Cn(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),ZK(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class P2 extends KK{type=YK.wordCloud;seriesType=GK.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([u0]);class B2 extends P2{static type=YK.wordCloud;static view="singleDefault";type=YK.wordCloud;seriesType=GK.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}fK.useSeries([p0]);class I2 extends P2{static type=YK.wordCloud3d;static view="singleDefault";type=YK.wordCloud3d;seriesType=GK.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class D2{plugins;id=Qo();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Uo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this.plugins.find((e=>e.id===t))}getAll(){return this.plugins.slice()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function L2(t){const e={...t};return un(t.style)||(e.textStyle=SX(t.style)),un(t.textStyle)||xn(e.textStyle,SX(t.textStyle)),t.shape?.style&&SX(e.shape.style),t.background?.style&&SX(e.background.style),e}function O2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class F2 extends kK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new D2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new BK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case n.cartesianBandAxis:return n2(LX(i),"band",e);case n.cartesianLinearAxis:return n2(LX(i),"linear",e);case n.cartesianAxis:case n.cartesianTimeAxis:return n2(LX(i),void 0,e);case n.polarBandAxis:return s2(i.orient,"band",e);case n.polarLinearAxis:return s2(i.orient,"linear",e);case n.polarAxis:return s2(i.orient,void 0,e);case n.cartesianCrosshair:case n.polarCrosshair:return e.component?.crosshair;case n.colorLegend:return e.component?.colorLegend[O2(i)];case n.sizeLegend:return e.component?.sizeLegend[O2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),en(this._originalSpec)?this._spec=this._originalSpec.map((t=>xn({},this._theme,t))):this._spec=xn({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:O$.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const z2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(Xi(a)||Xi(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},H2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{Xi(i[e])||t.latestData.forEach((t=>{Cn(i[e]).forEach((i=>{Xi(t[i])||(Xi(o[t[i]])&&(o[t[i]]=0),Xi(n[e])||(o[t[i]]+=parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class j2 extends F2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else zl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),zl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=LX(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?$h.horizontal:$h.vertical)===$h.horizontal,Ki(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(Ki(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):Ki(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),Xi(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Nl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(Ki(t)&&(Ki(t.userId)&&(this._seriesUserId=Cn(t.userId)),Ki(t.specIndex)&&(this._seriesIndex=Cn(t.specIndex))),Ki(this._spec.seriesId)){const t=Cn(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(Ki(this._spec.seriesIndex)){const t=Cn(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(Ki(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Cn(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(Ki(this._spec.regionId)){const t=Cn(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(Nl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];let n=!1;if(this._relatedAxisComponent){const s={};zl(this._regions,(r=>{const a="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,o="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!a||!o)return;const l=a.getAxisId()===this._relatedAxisComponent.id?a:o.getAxisId()===this._relatedAxisComponent.id?o:this._isHorizontal?a:o,h=l===a?o:a,c=Nl(h.getScale(0).type);c&&(n=!0),t.push(r.getRawData());const d=r.getSpec(),u=Cn(d.xField),p=Cn(d.yField),g="cartesian"===r.coordinate?u[u.length-1]:d.angleField??d.categoryField,f="cartesian"===r.coordinate?p[p.length-1]:d.radiusField??d.valueField;if(s[r.id]="link"===r.type?"from_xField":l===a?g:f,e.push(s[r.id]),this._valueField){const t="link"===r.type?"from_yField":h===a?g:f;i.push(c?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else n=Xi(this._spec.valueField),zl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;JX(s,"dataview",Lo),ZX(s,"dataFilterComputeDomain",H2);const r=new jo(s);r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:n?this._valueField:null}}},!1),this._data=new zK(this._option,r),r.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&Nl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&Nl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Nl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new hh,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(ZX(this._option.dataSet,"dataFilterWithNewDomain",z2),zl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>Nl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Nl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=Kn(this._start-s,0,1),a=Kn(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}Mn(j2,O1);class N2 extends j2{static type=n.scrollBar;type=n.scrollBar;name=n.scrollBar;layoutZIndex=J$.DataZoom;layoutLevel=Q$.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(Xi(i))return;if(!en(i))return new N2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new N2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return rn(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return rn(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new eU({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(L$.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return Xi(i)||(n.padding=i),un(t?.style)||(n.railStyle=SX(t.style)),un(e?.style)||(n.sliderStyle=SX(e.style)),n}}class V2 extends j2{static type=n.dataZoom;type=n.dataZoom;name=n.dataZoom;layoutZIndex=J$.DataZoom;layoutLevel=Q$.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(Xi(i))return;if(!en(i))return new V2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new V2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize)}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new xh;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return rn(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return rn(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._stateScale:this._valueScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().x+e};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?this._valueScale:this._stateScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().y+e};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new _G({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(L$.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:SX(this._spec.background?.style),startHandlerStyle:SX(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:SX(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:SX(this._spec.middleHandler.background?.style)}},endHandlerStyle:SX(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:SX(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:SX(this._spec.endText?.style)},selectedBackgroundStyle:SX(this._spec.selectedBackground.style),dragMaskStyle:SX(this._spec.dragMask?.style),backgroundChartStyle:{line:xn(SX(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...SX(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:xn(SX(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...SX(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class W2 extends F2{static type=n.customMark;type=n.customMark;layoutType="absolute";layoutZIndex=J$.CustomMark;layoutLevel=Q$.CustomMark;static createComponent(t,e){return t.customMark?[new W2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Jj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Jj}_${n}`});if(s&&(Xi(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),Ki(t.dataId)||an(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class U2 extends F2{layoutType="absolute";static type=n.brush;type=n.brush;name=n.brush;layoutZIndex=J$.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!Xi(i)&&!1!==i.visible)return[new U2(i,{...e,specKey:U2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new fY({zIndex:this.layoutZIndex,brushStyle:SX(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=L$.brushChange;r="brushStart"===n||"brushDown"===n?L$.brushStart:"brushEnd"===n||"brushMaskUp"===n?L$.brushEnd:L$.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{...SX(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&vr(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&_r(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){Ki(this._spec.regionId)&&Ki(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Cn(this._spec.regionId),Cn(this._spec.regionIndex))}_bindLinkedSeries(){Ki(this._spec.brushLinkSeriesId)&&Ki(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Cn(this._spec.brushLinkSeriesId),Cn(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&Cn(t).includes(s.userId)||e&&Cn(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var G2;function Y2(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function $2(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function X2(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:$2(t.rect),anchorCandidates:t3(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>Y2(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;tY2(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function K2(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=mr(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=J2(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=Ya(r,n,i);if(!J2(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],q2(Z2(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=q2(Z2(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=Q2(t.rect,a,0),t}));return X2(h)}function q2(t){return t>180?t-360:t}function Z2(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function J2(t,e){for(let i=0;i{const{x:r,y:a}=Q2({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(G2||(G2={}));class e3 extends F2{static type=n.mapLabel;type=n.mapLabel;name=n.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=J$.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!Ki(i.series)?new e3(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new jo(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new zK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new RG({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=Qh(this._spec.background?.padding),c=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const d={},u=this.dataToPosition(t),p=hB({});if(p.name=`${this.name}_marker_itemContainer_${e}`,d.container=p,this._spec.background?.visible){const t=uB(SX({...this._spec.background.style}));t.setAttributes(u),d.labelBackground=t,p.appendChild(t)}if(this._spec.icon?.visible){const t=fB(SX({...this._spec.icon.style}));t.setAttributes(u),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;d.icon=t,p.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=gB(SX({...this._spec.nameLabel.style}));e.setAttributes(u),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;d.nameLabel=e,p.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&Ki(t[this.valueField])){const e=gB(SX({...this._spec.valueLabel.style}));e.setAttributes(u),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;d.valueLabel=e,p.appendChild(e),a=Math.max(a,s),r+=o,i++}const g=Object.values(d).find((t=>!!t&&"group"!==t.type)),f={x:g?.getComputedAttribute("x"),y:g?.getComputedAttribute("y")},m={x:f.x,y:f.y,width:0,height:0};m.width=n+r+(i-1)*c,m.height=s+a;const y={rect:m,point:f,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));y.rect=Q2(m,o,l),y.anchors=t,y.offset=l}else y.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:y,contentMarks:d}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:SX({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):X2(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class i3{id;name;service;static Name;constructor(t=i3.Name){this.id=Qo(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function n3(t,e){const i=e.getSpec?.();un(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=BX(e.layoutOrient),r=t[0],a=Tn(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);n3(n?n.getChildren():[],t.component),n3(s?s.getChildren():[],t.component)}}function r3(t){return 2===t.length&&an(t[0])&&an(t[1])&&t[1]>=t[0]}function a3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!an(a.min),extendable_max:!an(a.max)}}function o3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function l3(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function h3(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function c3(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const d3=(t,e)=>t.map(((t,i)=>({index:i,value:t,label:e.labelFormatter?e.labelFormatter(t):`${t}`}))),u3=(t,e,i=0)=>{const n=new Ts(t).expand(i/2),s=new Ts(e).expand(i/2);return n.intersects(s)},p3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function f3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=kl(-90));const u=pX(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Ts).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},y3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return d3(p,r.options)};class _3 extends i3{Name="AxisSyncPlugin";constructor(){super(_3.Name)}_checkEnableSync(t){if(!Nl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(L$.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!Nl(i.type)||!Nl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!r3(s)||!r3(r))return;const a=a3(t,s),o=a3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!l3(a,o))return}else if(0===p&&0===g){if(!l3(o,a))return}else if(u||y)if(u&&!y){if(!o3(a,o))return}else if(y&&!u){if(!o3(o,a))return}else{if(h===g)return;if(h>g){if(!h3(a,o))return}else if(!h3(o,a))return}else{if(0===h&&0===p){if(!c3(a,o))return}else if(0===g&&0===l&&!c3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){ZX(e.getOption().dataSet,"tickAlign",y3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var v3={AxisLabelOverlapPlugin:s3,AxisSyncPlugin:_3};const b3=t=>t,x3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!g3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},S3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?p3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return d3(t.domain(),e);let h;if(Ki(s))h=t.stepTicks(s);else if(Ki(n))h=t.forceTicks(n);else if(Ki(i))h=t.ticks(i);else{const i=t.domain(),n=t.range(),s=Q1(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=Q1(r),c=pX(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Ll(u),{x:m,y:y}=Is({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Ts).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=A3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}return d3(h,e)},A3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&u3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},k3=(t,e)=>{if(Nl(t.type))return((t,e)=>{if(!Nl(t.type))return d3(t.domain(),e);const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=Ki(s)?t.stepTicks(s):Ki(n)?t.forceTicks(n):t.ticks(i??5),"cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType){const{labelGap:i=4,labelFlush:n}=e;let s=m3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&f3(s,i);)s=x3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),Tn(a)!==Tn(r)&&a.push(Tn(r))),r=a}return d3(r,e)})(t,e);if(Wl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(Ki(s))l=t.stepTicks(s);else if(Ki(n))l=t.forceTicks(n);else if(Ki(i))l=t.ticks(i);else{const i=t.domain(),n=t.range(),s=m3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=S3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}return d3(l,e)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return w3(t,e)}return d3(t.domain(),e)};class M3 extends F2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),Ki(this._spec.id)&&t.setUserId(this._spec.id),Yi(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==pn(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=DZ(BZ.axis(),{appear:this._spec.animationAppear??pn(this._option.getChart().getSpec(),"animationAppear.axis")??pn(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??pn(this._option.getChart().getSpec(),"animationDisappear.axis")??pn(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??pn(this._option.getChart().getSpec(),"animationEnter.axis")??pn(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??pn(this._option.getChart().getSpec(),"animationExit.axis")??pn(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??pn(this._option.getChart().getSpec(),"animationUpdate.axis")??pn(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return zl(this._regions,(e=>{en(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;Ki(t)&&(this._seriesUserId=Cn(t)),Ki(i)&&(this._regionUserId=Cn(i)),Ki(e)&&(this._seriesIndex=Cn(e)),Ki(n)&&(this._regionIndex=Cn(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(zl(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!Nl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(zl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return en(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===JU.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&Xi(t.title.angle)&&(i="left"===t.orient?-90:90,e=J1[t.orient]),{select:t.select,hover:t.hover,line:(n=t.domainLine,bX(n),bX(n.startSymbol),bX(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:$i(t.label.style)?(e,i)=>{const n=this._preprocessSpec(t.label.style(e.rawValue,i,e));return SX(this._preprocessSpec(xn({},this._theme.label?.style,n)))}:SX(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:xX(t.label.state)},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:$i(t.tick.style)?(e,i)=>{const n=this._preprocessSpec(t.tick.style(e.rawValue,i,e));return SX(this._preprocessSpec(xn({},this._theme.tick?.style,n)))}:SX(t.tick.style),state:xX(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:SX(t.subTick.style),state:xX(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:$i(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return SX(this._preprocessSpec(xn({},this._theme.grid?.style,n)))}:SX(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:SX(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Es(i):null,textStyle:xn({},e,SX(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:SX(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:SX(t.title.background?.style)},state:{text:xX(t.title.state),shape:xX(t.title.shape?.state),background:xX(t.title.background?.state)}},panel:{visible:t.background?.visible,style:SX(t.background?.style),state:xX(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const C3=[v3.AxisLabelOverlapPlugin,v3.AxisSyncPlugin];class T3 extends M3{static type=n.cartesianAxis;type=n.cartesianAxis;name=n.cartesianAxis;layoutType="region-relative";layoutZIndex=J$.Axis;layoutLevel=Q$.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;constructor(t,e){super(t,{...e}),this._orient=LX(t,["z"]),DX(this._orient)&&(this.layoutType="absolute"),Ki(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?BX(t)?"linear":"band":BX(t)?"band":"linear"}(t.orient,i),s=`${T3.type}-${n}`,r=AX.getComponentInKey(s);if(r){let n=t.inverse;return i&&!BX(t.orient)&&(n=!Ki(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(T3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[T3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===$h.horizontal;if(!en(i))return e2(i)?T3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>IX(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{e2(t)&&a.push(T3.createAxis(t,{...e,specIndex:i,specKey:T3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),zl(this._regions,(t=>{BX(this.orient)?t.setXAxisHelper(this.axisHelper()):IX(this.orient)?t.setYAxisHelper(this.axisHelper()):DX(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];BX(this.orient)?an(e)&&(s=n?[e,0]:[0,e]):DX(this.orient)?an(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):an(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(C3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=BX(this.orient)?t.fieldX:DX(this.orient)?t.fieldZ:t.fieldY,Nl(this._scale.type)?e:[e[0]]}_initData(){JX(this._option.dataSet,"scale",b3),ZX(this._option.dataSet,"ticks",k3);const t=this._spec.label||{},e=this._tick||{},i=new jo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new zK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(uV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(BX(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(L$.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return zl(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return zl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:BX(this.orient)?i.fieldX:DX(this.orient)?i.fieldZ:i.fieldY,n=en(n)?Nl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){zl(this._regions,(t=>{BX(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):IX(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):DX(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;an(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),an(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=BX(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(xn({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=xn({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&Xi(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=BX(this.orient),s=t=>(n?!BX(t.orient):BX(t.orient))&&Nl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(Ki(t))a=r.find((e=>e.id===t));else if(Ki(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const E3=Math.sqrt(50),R3=Math.sqrt(10),P3=Math.sqrt(2);class B3{_extend={};setExtraAttrFromSpec(){Ki(this._spec.nice)&&(this._nice=this._spec.nice),Ki(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=t2(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),Xi(this._domain?.min)&&Xi(this._domain?.max)?this._nice&&this._scale.nice(t):Ki(this._domain?.min)&&Xi(this._domain?.max)?this._nice&&this._scale.niceMax(t):Xi(this._domain?.min)&&Ki(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];Ki(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),Ki(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(En(t)-function(t){if(t&&en(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=E3?10:s>=R3?5:s>=P3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),Xi(this._domain?.min)&&Xi(this._domain?.max)?this._scale.nice(t):Ki(this._domain?.min)&&Xi(this._domain?.max)?this._scale.niceMax(t):Xi(this._domain?.min)&&Ki(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(L$.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}Mn(L3,D3);class O3 extends I3{static type=n.cartesianTimeAxis;type=n.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),zl(this._regions,(t=>{BX(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=xn({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new jo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new zK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=No.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return en(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&en(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class F3 extends M3{static type=n.polarAxis;type=n.polarAxis;name=n.polarAxis;layoutType="absolute";layoutZIndex=J$.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=AN;get startAngle(){return this._startAngle}_endAngle=kN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${F3.type}-${i}`,s=AX.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(F3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!en(i))return i2(i)?(i.center=t.center,i.startAngle=t.startAngle??MN,i.endAngle=t.endAngle??(Ki(t.startAngle)?t.startAngle+360:CN),F3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!i2(i))return;i.center=t.center,i.startAngle=t.startAngle??MN,i.endAngle=t.endAngle??(Ki(t.startAngle)?t.startAngle+360:CN),i.outerRadius=i.radius??t.outerRadius??t.radius??TN;const o=F3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),zl(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=kl(this._spec.startAngle??MN),this._endAngle=kl(this._spec.endAngle??(Ki(this._spec.startAngle)?this._spec.startAngle+360:CN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(L$.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){JX(this._option.dataSet,"scale",b3),ZX(this._option.dataSet,"ticks",k3);const t=this._spec.label||{},e=this._spec.tick||{},i=new jo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new zK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return zl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=en(n)?Nl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){zl(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return Nl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=Cl({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:en(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=ks.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:en(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=TN,e=0;const i=this.getChart().getSpec();return zl(this.getRegions(),(n=>{const s=n;if(function(t){return[GK.rose,GK.radar,GK.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;an(n)&&(t=n),an(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(xn({},this._axisStyle,t))}}class z3 extends F3{static type=n.polarLinearAxis;type=n.polarLinearAxis;_zero=!0;_nice=!0;_scale=new xh;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}Mn(z3,B3);class H3 extends F3{static type=n.polarBandAxis;type=n.polarBandAxis;_scale=new hh;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function j3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:c,data:d,filter:u,regionId:p,regionIndex:g,seriesIndex:f,seriesId:m,padding:y,..._}=xn({},t),v=_;return i.visible&&(v.title=L2(i)),un(n.focusIconStyle)||SX(n.focusIconStyle),bX(n.shape),bX(n.label),bX(n.value),bX(n.background),qh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),qh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),qh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),v.item=n,un(s.textStyle)||SX(s.textStyle),bX(s.handler),v.pager=s,r.visible&&!un(r.style)&&(xn(v,r.style),Ki(r.padding)&&(v.padding=r.padding)),v}Mn(H3,D3);const N3=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},V3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return Ki(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class W3 extends F2{layoutType="normal";layoutZIndex=J$.Legend;layoutLevel=Q$.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{zl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),zl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Xh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;Ki(i)&&(this._seriesUserId=Cn(i)),Ki(t)&&(this._regionUserId=Cn(t)),Ki(n)&&(this._seriesIndex=Cn(n)),Ki(e)&&(this._regionUserIndex=Cn(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new zK(this._option,t),this._initSelectedData(),zl(this._regions,(t=>{t.event.on(L$.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;Xi(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(L$.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;an(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)An(n,this._cacheAttrs)||this._legendComponent.setAttributes(xn({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(xn({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class U3 extends W3{static type=n.discreteLegend;type=n.discreteLegend;name=n.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!en(i))return i.type&&"discrete"!==i.type?void 0:new U3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new U3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),zl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){ZX(this._option.dataSet,"discreteLegendFilter",V3),ZX(this._option.dataSet,"discreteLegendDataMake",N3);const t=new jo(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!el(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&Xi(t.title.text)&&Xi(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=yX(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...j3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return VG}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(FG.legendItemClick,(e=>{const i=pn(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(L$.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(FG.legendItemHover,(t=>{const e=pn(t,"detail");this.event.emit(L$.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(FG.legendItemUnHover,(t=>{const e=pn(t,"detail");this.event.emit(L$.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:an(r)?r:1,strokeOpacity:an(a)?a:1,opacity:an(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return $i(this._spec.data)?this._spec.data(t):t}}const G3=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;an(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},Y3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!un(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function $3(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:c,id:d,visible:u,orient:p,position:g,data:f,defaultSelected:m,field:y,filter:_,regionId:v,regionIndex:b,seriesIndex:x,seriesId:S,padding:w,...A}=xn({},t),k=A;return e.visible&&(k.title=L2(e)),k.showHandler=!1!==i.visible,un(i.style)||(k.handlerStyle=SX(i.style)),Ki(n.width)&&(k.railWidth=n.width),Ki(n.height)&&(k.railHeight=n.height),un(n.style)||(k.railStyle=SX(n.style)),un(s.style)||(k.trackStyle=SX(s.style)),k.startText=bX(r),k.endText=bX(a),k.handlerText=bX(o),un(l)||(k.sizeBackground=SX(l)),h.visible&&!un(h.style)&&(xn(k,h.style),Ki(h.padding)&&(k.padding=h.padding)),k}function X3(t){return"color"===t||"size"===t}const K3={color:$G,size:KG},q3=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Z3=[2,10];class J3 extends W3{static type=n.continuousLegend;type=n.colorLegend;name=n.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!en(i))return X3(i.type)?new J3(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{X3(t.type)&&n.push(new J3(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?n.colorLegend:n.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),zl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){ZX(this._option.dataSet,"continuousLegendFilter",Y3),ZX(this._option.dataSet,"continuousLegendDataMake",G3);const t=new jo(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&Xi(t.title.text)&&Xi(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=yX(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!el(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=yX(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),un(n)&&(n="color"===this._legendType?q3:Z3);const r={...$3(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return K3[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",Qn((e=>{const i=pn(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(L$.legendFilter,{model:this,value:i,event:e})}),30))}}}const Q3=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),Cn(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class t5 extends F2{static type=n.indicator;type=n.indicator;name=n.indicator;layoutType="absolute";layoutZIndex=J$.Indicator;layoutLevel=Q$.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==t5.type)return null;const i=Cn(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map((t=>new t5(t,e)));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(Cn(this._spec.regionId),Cn(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){ZX(this._option.dataSet,"indicatorFilter",Q3);const t=new jo(this._option.dataSet);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 zK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return Cn(this._spec.content).forEach((t=>{const e=xn({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{...SX(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!Ki(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{...SX(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)An(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new JG(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":$i(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return zl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){super.clear(),this._indicatorComponent=null,this._cacheAttrs=null}}class e5 extends F2{static type=n.title;type=n.title;layoutType="normal";layoutZIndex=J$.Title;layoutLevel=Q$.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Xh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!en(i))return new e5(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new e5(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;an(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),an(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:an(t.width())?t.width():0,height:this._spec.height?this._spec.height:an(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)An(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new qG(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class i5{projection;constructor(t){if(this.projection=mJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function n5(t,e){return`${Jj}_${e}_${t}`}class s5 extends F2{static type=n.geoCoordinate;type=n.geoCoordinate;name=n.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:n5(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(Xi(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new s5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=xn(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(L$.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new i5(this._projectionSpec)}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===GK.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===GK.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(GK.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==GK.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}Mn(s5,O1);const r5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},a5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class o5 extends F2{layoutType="absolute";gridZIndex=J$.CrossHair_Grid;labelZIndex=J$.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();en(t)?t.forEach(((t,i)=>this._registerEvent(t,en(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:O$.chart},this._handleEvent),this.event.on(e,{level:F$.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ts((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(r5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(en(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(r5[e][t]),s=s.concat(r5[e][i(t)])})),{in:n,out:s}}return{in:r5[e][t],out:r5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=pn(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{a5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();en(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),en(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function h5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var c5,d5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(c5||(c5={}));class u5 extends o5{static type=n.cartesianCrosshair;type=n.cartesianCrosshair;name=n.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(Xi(i))return;if(!en(i))return i.xField||i.yField?new u5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new u5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,c5.VERTICAL,!0),this.layoutByValue(c5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,c5.HORIZONTAL,!1),this.layoutByValue(c5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return Nl(t.getScale().type)&&an(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){BX(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{Wl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(c5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=c5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,c;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(Wl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(Nl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=h5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=Q1(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(Wl(s.type)){const t=s._step;c=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(Nl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=h5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(c=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):c=1,a=r}}if(this.yHair.label?.visible){const e=Q1(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&Ki(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&Ki(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(c5.HORIZONTAL&&this._layoutHorizontal(n,c??0),c5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new SU({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new wU({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new bU(e)),n.add(t)),l5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(d5||(d5={}));class p5 extends o5{static type=n.polarCrosshair;type=n.polarCrosshair;name=n.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(Xi(i))return;if(!en(i))return i.categoryField||i.valueField?new p5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new p5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{Wl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});Nl(s.getScale().type)&&an(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:ks.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(d5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",xn(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=Q1(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=Q1(t.getSpec())),n.angle=i.angle,n.axis=t,xn(n,s)}))),this.enableRemain&&!i.visible&&Ki(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&Ki(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(d5.HORIZONTAL&&this._layoutHorizontal(n),d5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:Is(l,n,i),end:Is(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new SU({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new kU({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Ll(i),e={...Is(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Ds(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=Is(t,s,p),m=Is(t,s,g),y=sr([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=Kn(ks.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new MU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new AU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=Al(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}}(i),n={...Is(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new bU(e),n.add(t),i(t)),l5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const g5=t=>SX({...t}),f5=t=>({...t,style:{...SX(t.style)}}),m5=t=>{const e=g5(t?.slider?.trackStyle??{}),i=g5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},SX({...s}));var s;const r=f5(t?.controller?.start??{}),a=f5(t?.controller?.pause??{}),o=f5(t?.controller?.backward??{}),l=f5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},y5=(t,e)=>({...m5(t),data:e,type:"continuous"}),_5=(t,e)=>({...m5(t),data:e,type:"discrete"}),v5=t=>"left"===t||"right"===t,b5=t=>"top"===t||"bottom"===t;class x5 extends F2{layoutZIndex=J$.Player;layoutLevel=Q$.Player;static type=n.player;type=n.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return Xi(i)||!1===i.visible?null:new x5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),an(t.x)){const e=v5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(an(t.y)){const e=b5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(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}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{..._5(this._spec,this._specs),...e}:{...y5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?An(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new dY(t):this._playerComponent=new pY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 rn(this._spec.width)?Math.min(t.width,Number(this._spec.width)):v5(this._orient)?this._maxSize():t.width}_computeHeight(t){return rn(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):b5(this._orient)?this._maxSize():t.height}_computeDx(t){return v5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return b5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...Cn(this._spec.controller.start?.style?.size),...Cn(this._spec.controller.pause?.style?.size),...Cn(this._spec.controller.backward?.style?.size),...Cn(this._spec.controller.forward?.style?.size),(v5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(v5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...Cn(this._spec.controller.start?.style?.size),...Cn(this._spec.controller.pause?.style?.size),...Cn(this._spec.controller.backward?.style?.size),...Cn(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(L$.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(aY.OnEnd,(()=>{this.event.emit(L$.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(aY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];Cn(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(L$.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const S5=(t,e)=>Pl(t[0].latestData,e.field),w5=(t,e)=>Bl(t[0].latestData,e.field);function A5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return an(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function k5(t,e){return Il(t[0].latestData,e.field)}function M5(t,e){return Dl(t[0].latestData,e.field)}function C5(t,e){return function(t,e){return Math.sqrt(Dl(t,e))}(t[0].latestData,e.field)}function T5(t,e){return function(t,e){return Fn(t.map((t=>t[e])))}(t[0].latestData,e.field)}function E5(t,e){const i={min:S5,max:w5,sum:A5,average:k5,variance:M5,standardDeviation:C5,median:T5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(Ki(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(Ki(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function R5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],c=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,d=n.getXAxisHelper().getScale(0).domain();return c.forEach((t=>{if(Ki(t.x)){rn(t.x)&&I5(d,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function P5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],c=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,d=n.getYAxisHelper().getScale(0).domain();return c.forEach((t=>{if(Ki(t.y)){rn(t.y)&&I5(d,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function B5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();rn(t.x)&&I5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),rn(t.y)&&I5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function I5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const D5=["sum","average","min","max","variance","standardDeviation","median"];class L5 extends F2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||D5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??Cn(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(Cn(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Pl(t,e),r=Bl(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class F5 extends L5{static type=n.markLine;type=n.markLine;name=n.markLine;layoutZIndex=J$.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(Xi(i))return;if(!en(i)&&!1!==i.visible)return new F5(i,{...e,specKey:F5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new F5(t,{...e,specIndex:i,specKey:F5.speckey}))})),n}_createMarkerComponent(){const t=new TG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:SX(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:SX(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:SX(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...SX(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...SX(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:SX(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=Ki(t.x)||Ki(t.coordinates)&&Ki(t.process)&&Ki(t.process.x),a=Ki(t.y)||Ki(t.coordinates)&&Ki(t.process)&&Ki(t.process.y),o=Ki(t.coordinates)&&(!Ki(t.process)||"process"in t&&"xy"in t.process),l=Ki(t.positions),h=t?.autoRange??!1;let c=[];r?c=R5(e,i,n,s,h)[0]:a?c=P5(e,i,n,s,h)[0]:o?c=B5(e,s,h):l&&(c=t.positions),this._markerComponent?.setAttributes({points:c})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;ZX(this._option.dataSet,"markerAggregation",E5),ZX(this._option.dataSet,"markerRegression",O5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new jo(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new jo(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class z5 extends L5{static type=n.markArea;type=n.markArea;name=n.markArea;layoutZIndex=J$.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(Xi(i))return;if(!en(i)&&!1!==i.visible)return new z5(i,{...e,specKey:z5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new z5(t,{...e,specIndex:i,specKey:z5.speckey}))})),n}_createMarkerComponent(){const t=new EG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:SX(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...SX(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...SX(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:SX(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=Ki(t.x)&&Ki(t.x1),a=Ki(t.y)&&Ki(t.y1),o=Ki(t.coordinates),l=Ki(t.positions),h=t?.autoRange??!1;let c=[],d=[];r?(d=R5(e,i,n,s,h),c=[...d[0],d[1][1],d[1][0]]):a?(d=P5(e,i,n,s,h),c=[...d[0],d[1][1],d[1][0]]):o?c=B5(e,s,h):l&&(c=t.positions),this._markerComponent?.setAttributes({points:c})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=Ki(t.x)&&Ki(t.x1),n=Ki(t.y)&&Ki(t.y1),s=Ki(t.coordinates);if(!i&&!n&&!s)return null;let r;ZX(this._option.dataSet,"markerAggregation",E5),ZX(this._option.dataSet,"markerRegression",O5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new jo(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class H5 extends L5{static type=n.markPoint;type=n.markPoint;name=n.markPoint;layoutZIndex=J$.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(Xi(i))return;if(!en(i)&&!1!==i.visible)return new H5(i,{...e,specKey:H5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new H5(t,{...e,specIndex:i,specKey:H5.speckey}))})),n}_createMarkerComponent(){const t=new RG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:SX(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:SX(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{...SX(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{...SX(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:SX(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=B5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!Ki(t.coordinate))return;ZX(this._option.dataSet,"markerAggregation",E5);const i=this._processSpecCoo(t),n=new jo(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const j5=(t,e,i)=>Xi(t)?t:$i(t)?t(e,i):t,N5=(t,e,i)=>{if(Xi(t))return t;if(en(t)){const n=[];return t.forEach((t=>{if($i(t)){const s=t(e,i);Ki(s)&&n.push(s)}else n.push(t)})),n}return $i(t)?t(e,i):t};const V5="vchart-tooltip-container",W5=20,U5={key:"其他",value:"..."},G5={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class Y5{static dom=`${Jj}_TOOLTIP_HANDLER_DOM`;static canvas=`${Jj}_TOOLTIP_HANDLER_CANVAS`}const $5=(t,e,i)=>{const n=j5(e.key,t,i),s=j5(e.value,t,i),r=!1!==j5(e.visible,t,i)&&(Ki(n)||Ki(s)),a=j5(e.isKeyAdaptive,t,i),o=j5(e.shapeType,t,i),l=j5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},X5=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,K5=(t,e)=>{let i;if(Ki(t))if(rn(t))i=t;else if($i(t)){const n=t(e);rn(n)&&(i=n)}return i},q5=(t,e)=>{const i=pX(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function Z5(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Bj,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var J5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(J5||(J5={}));class Q5{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),J5.success):(this._updateTooltip(!1,e),J5.success)}if(Xi(n)||Xi(s))return J5.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(Ki(t.visible)||Ki(t.activeType)?s.visible=dq(t).includes("mark"):Ki(e.visible)||Ki(e.activeType)?s.visible=dq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=X5(i,"mark")??{},a=xn({},yn(e.mark),yn(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(Ki))),[]);if(t.every((t=>!dq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:Ki(e.visible)||Ki(e.activeType)?s.visible=dq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=X5(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{$i(t)?o.push(t):o.push(...Cn(t))})),r={...i[0],content:o};let l={};const h=t.filter((t=>{const e=t.tooltipHelper?.spec;return Ki(e?.dimension)&&dq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(h.length){let t=[];h.every((({content:t})=>Xi(t)))?t=void 0:h.forEach((({content:e})=>{Xi(e)||($i(e)?t?.push(e):t?.push(...Cn(e)))})),l={...h[0],content:t}}a=xn({},yn(e.dimension),l)}const o=r.title,l={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(Ki(a.title))if($i(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...l,...n}}}else a.title={...r.title,...l,...a.title};else a.title={...r.title,...l};const h=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),c=Cn(r.content);if(Ki(a.content))if($i(a.content)){const t=a.content;a.content=(e,i)=>{const n=Cn(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...h(c[0]),...t}})),n}}else{const t=Cn(a.content);t.forEach(((e,i)=>{t[i]={...h(c[0]),...e}}))}else a.content=c.map((t=>({...t,...h(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return J5.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??J5.success;const a=r[n];if(!a)return J5.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),Xi(o.title?.key)&&Xi(o.title?.value)&&!o.content?.length?J5.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??J5.success;const o=i[n];if(!o)return J5.failed;const l=this._getActualTooltipPosition(e,N5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),J5.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=rn(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ts(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...G5,offsetX:t?.x??G5.offsetX,offsetY:t?.y??G5.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=N5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=N5(t.title,e,i),s=Cn(N5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=W5}=t,o=!1!==j5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,Ki(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=j5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=$5(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...U5});break}if(!(r.content.lengthXi(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=$5(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...U5});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(Xi(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),Xi(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!Ki(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,c=this._component.getSpec(),d="canvas"===c.renderMode,u=i?.chart?.getCanvasRect(),p=u?.width??Qj,g=u?.height??tN;let f,m,y,_,v,b,x=!1;if(qi(e)){const{left:t,right:i,top:n,bottom:s}=e;f=K5(t,r),m=K5(n,r),y=K5(i,r),_=K5(s,r)}else if(Ki(e)&&"mark"===t.activeType){x=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case PX.left:f=t-a-l,m=(i+c)/2-o/2;break;case PX.right:f=n+l,m=(i+c)/2-o/2;break;case PX.top:f=(t+n)/2-a/2,m=i-o-h;break;case PX.bottom:f=(t+n)/2-a/2,m=c+h;break;case PX.inside:f=(t+n)/2-a/2,m=(i+c)/2-o/2}}}const S={width:0,height:0},w=(t=0)=>({x:t,y:t});let A=w(),k=w(),M=1,C=1;if(Ko(this._env)&&!c.confine){if(S.width=window.innerWidth,S.height=window.innerHeight,!d){const t=this._compiler.getCanvas()??this._chartContainer;k=n.getBoundingClientRect();const e=t.getBoundingClientRect();A={x:e.x-k.x,y:e.y-k.y},M=t4(t),C=t4(n)}}else S.width=p,S.height=g;const{canvasX:T,canvasY:E}=r;v=an(f)?f:an(y)?p-a-y:T+l,b=an(m)?m:an(_)?g-o-_:E+h,v*=M,b*=M,Ko(this._env)&&(v+=A.x,b+=A.y),v/=C,b/=C;const{width:R,height:P}=S;return(v+a)*C+k.x>R&&(x?v=(R-k.x)/C-a:v-=2*l+a),(b+o)*C+k.y>P&&(x?b=(P-k.y)/C-o:b-=2*h+o),v*C+k.x<0&&(v=0-k.x/C),b*C+k.y<0&&(b=0-k.y/C),{x:v,y:b}};_getTooltipBoxSize(t,e){return e&&!Xi(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:c=[]}=t;let d=0,u=n.top+n.bottom,p=0;const{visible:g=!0,value:f="",hasShape:m,shapeType:y="",shapeHollow:_,shapeColor:v}=h;if(l.title.visible=g,g){const{text:t,width:e,height:i}=q5(f,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},d=e,p=i,m&&YR[y]){const t={symbolType:y};_?t.stroke=v:t.fill=v,l.title.shape=t,d+=r.size+r.spacing,p=Math.max(r.size,p)}l.title.width=d,l.title.height=p,u+=p}if(c.length){const t=c.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){g&&(u+=i);let e=!1;const n=[],h=[],c=[];l.content=t.map(((l,d)=>{const p={height:0,spaceRow:i};let g=0;const{hasShape:f,key:m,shapeColor:y,shapeHollow:_,shapeType:v="",value:b,isKeyAdaptive:x}=l;if(Ki(m)){const{width:t,height:e,text:i}=q5(m,a);p.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},x?h.push(t):n.push(t),g=Math.max(g,e)}if(Ki(b)){const{width:t,height:e,text:i}=q5(b,o);p.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},c.push(t),g=Math.max(g,e)}if(f&&YR[v]){e=!0;const t={visible:!0,symbolType:v};_?t.stroke=y:t.fill=y,g=Math.max(r.size,g),p.shape=t}else p.shape={visible:!1};return p.height=g,u+=g,dt.offsetWidth>0?t.getBoundingClientRect().width/t.offsetWidth:t.getBoundingClientRect().height/t.offsetHeight,e4=(t,e)=>Ki(t)?en(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function i4(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=xn({},e,t),d={};return d.fontFamily=i,d.fontSize=e4(n),d.color=s,d.textAlign=r,d.lineHeight=e4(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=e4(c),d}function n4(t,e){if(!t)return;const{size:i}=xn({},e,t),n={};return n.width=e4(i),n}class s4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===s4.type}type=s4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return s4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=Xo?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(s4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const r4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},a4={boxSizing:"border-box"},o4={display:"flex",whiteSpace:"nowrap"},l4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},h4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},c4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},d4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},u4={lineHeight:"normal"};class p4 extends s4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!YR[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=YR[e].pathStr;let o="currentColor";if(!n||tn(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(qi(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class g4 extends s4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class f4 extends s4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=Dn(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=Dn(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(xn({},l4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=xn({},a?c4:h4,{height:e4(i[n].height),...t.keyColumn.item});tn(r)&&""!==r?.trim?.()||rn(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=xn({},d4,{height:e4(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=xn({},u4,{height:e4(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=tn(s)&&""!==s?.trim?.()||rn(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=tn(s)&&""!==s?.trim?.()||rn(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class m4 extends s4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new f4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new f4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new f4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(xn({},o4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class y4 extends s4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new p4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new g4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(xn({},r4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class _4 extends s4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&Ki(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new y4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new m4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(xn({},a4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class v4 extends Q5{type=Y5.dom;_tooltipContainer=Xo?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(Xo&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:c,lineWidth:d=0},padding:u,key:p,value:g,title:f,shape:m,enterable:y,spaceRow:_,transitionDuration:v}=t,b=i,x={panel:{width:e4((e?.panel?.width??0)+2*d),height:e4((e?.panel?.height??0)+2*d),paddingBottom:e4(u.bottom),paddingLeft:e4(u.left),paddingRight:e4(u.right),paddingTop:e4(u.top),borderColor:c,borderWidth:e4(d),borderRadius:e4(h),backgroundColor:b?`${b}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:y?"auto":"none",transitionDuration:v?`${v}ms`:"initial",transitionProperty:v?"transform":"initial",transitionTimingFunction:v?"ease-out":"initial"},title:i4(f),content:{},shapeColumn:{item:n4(m),width:e4(m.size),marginRight:e4(m.spacing??8)},keyColumn:{item:i4(p),width:e4(e?.keyWidth),marginRight:e4(p.spacing??26)},valueColumn:{item:i4(g),width:e4(e?.valueWidth),marginRight:e4(g.spacing??0)},spaceRow:e4(_)};if(Ki(_)){const t=_/2;[x.shapeColumn.item,x.keyColumn.item,x.valueColumn.item].forEach((e=>{e.marginTop=e4(t),e.marginBottom=e.marginTop})),x.content.marginTop=e4(-t),x.content.marginBottom=x.content.marginTop}else[x.content,x.shapeColumn.item,x.keyColumn.item,x.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return x}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class b4 extends Q5{type=Y5.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new bY({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}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?Ki(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class x4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&Ki(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??J5.success:J5.failed}class S4 extends x4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(Xi(i))return!1;if(![Y5.dom,Y5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!uq(t)&&!Xi(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...HX(r,a)??[],...WX(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(Ki(i))break}return Ki(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class w4 extends x4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(Xi(i))return!1;if(![Y5.dom,Y5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const A4=t=>Ki(t)&&!en(t),k4=t=>Ki(t)&&en(t);class M4 extends F2{static type=n.tooltip;type=n.tooltip;name=n.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!en(i))return new M4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new M4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?b4:v4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new w4(this),dimension:new S4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:F$.chart},this._handleMouseMove),(qo(e)||Zo(e))&&(this._mountEvent("pointerdown",{level:F$.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:F$.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;Ko(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||uq(t)||(n&&A4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&k4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):Ki(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!Xi(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&fK.globalConfig.uniqueTooltip&&fK.hideTooltip(a.id),r};_getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=xn({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!Ki(t.visible)||t.visible,activeType:dq(t),renderMode:"html",trigger:Ki(t.trigger)?t.trigger:"hover",className:Ki(t.className)?t.className:"vchart-tooltip-element",enterable:!!Ki(t.enterable)&&t.enterable,transitionDuration:Ki(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=Ki(t.triggerOff)?t.triggerOff:this._spec.trigger,Ki(t.renderMode)?this._spec.renderMode=t.renderMode:Zo(this._option.mode)&&(this._spec.renderMode="canvas"),Ki(t.mark)&&(this._spec.mark={...yn(t.mark),activeType:"mark"}),Ki(t.dimension)&&(this._spec.dimension={...yn(t.dimension),activeType:"dimension"}),Ki(t.parentElement)?tn(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Ko(this._option.mode)&&(this._spec.parentElement=Xo?.body),Ki(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=cq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:O$.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(Xi(this._cacheInfo)||Xi(t))return!1;if(k4(t)){if(A4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>MX(t,e[i])))}if(k4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(Ki(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(Ki(n)&&Ki(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function C4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function T4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const E4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??C4(e)};let o=!1;return tn(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??T4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class R4 extends F2{static type=n.label;type=n.label;name=n.label;layoutType="absolute";layoutZIndex=J$.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new R4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(L$.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(uV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(uV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),zl(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:wX.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:wX.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=E4[s.type]??E4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return xn({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class P4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(an(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:$i(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&Ki(t.modelId)){if(Ki(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&Ki(t.modelKey)&&"modelIndex"in t&&Ki(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>B4(t))),a=s.filter((t=>!B4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>B4(t))),h=o.filter((t=>!B4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);an(o.width)||(o.width=a.width),an(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function B4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class I4 extends DK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&BX(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&IX(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}fK.useChart([W1,u2,U1,G1,M2,p2,f2,m2,A2,b2,X1,C2,c2,d2,y2,B2,I2,q1,Z1,_2,S2,w2,T2,$1,E2,R2,Y1,k2,o2,x2,l2]),fK.useComponent([I3,L3,O3,H3,z3,U3,J3,M4,u5,p5,V2,N2,t5,s5,F5,e5,z5,x5,R4,H5,U2,W2,e3]),AX.registerLayout("grid",P4),AX.registerLayout("layout3d",I4),t.Arc3dMark=NJ,t.ArcMark=zJ,t.AreaChart=W1,t.AreaMark=cJ,t.AreaSeries=dJ,t.Bar3dChart=G1,t.Bar3dSeries=rJ,t.BarChart=U1,t.BarSeries=VZ,t.BaseChart=KK,t.BaseMark=NK,t.BaseSeries=Mq,t.BoxPlotChart=Y1,t.BoxPlotMark=KZ,t.BoxPlotSeries=JZ,t.Brush=U2,t.CartesianAxis=T3,t.CartesianBandAxis=L3,t.CartesianChart=qK,t.CartesianCrossHair=u5,t.CartesianLinearAxis=I3,t.CartesianSeries=Cq,t.CartesianTimeAxis=O3,t.CellMark=N1,t.CirclePackingChart=$1,t.CirclePackingSeries=v1,t.CircularProgressChart=y2,t.CircularProgressSeries=aQ,t.CommonChart=X1,t.ComponentMark=WK,t.ContinuousLegend=J3,t.CustomMark=W2,t.DataZoom=V2,t.DiscreteLegend=U3,t.DotSeries=eQ,t.Factory=AX,t.Funnel3dChart=Z1,t.Funnel3dSeries=B0,t.FunnelChart=q1,t.FunnelSeries=R0,t.GaugeChart=o2,t.GaugePointerSeries=z1,t.GaugeSeries=H1,t.GeoCoordinate=s5,t.GridLayout=P4,t.GroupMark=VK,t.HeatmapChart=l2,t.HeatmapSeries=V1,t.Histogram3dChart=d2,t.HistogramChart=c2,t.Indicator=t5,t.Label=R4,t.Layout=DK,t.Layout3d=I4,t.LineChart=u2,t.LineMark=iJ,t.LineSeries=nJ,t.LinearProgressChart=_2,t.LinearProgressSeries=lQ,t.LinkPathMark=P1,t.LinkSeries=nQ,t.MapChart=p2,t.MapLabelComponent=e3,t.MapSeries=PJ,t.MarkArea=z5,t.MarkLine=F5,t.MarkPoint=H5,t.PathMark=CJ,t.Pie3dChart=m2,t.Pie3dSeries=VJ,t.PieChart=f2,t.PieSeries=jJ,t.Player=x5,t.PolarAxis=F3,t.PolarBandAxis=H3,t.PolarChart=r2,t.PolarCrossHair=p5,t.PolarLinearAxis=z3,t.PolarSeries=BJ,t.PolygonMark=E0,t.ProgressArcMark=rQ,t.ProgressLikeChart=a2,t.ProgressLikeSeries=sQ,t.Pyramid3dMark=P0,t.RadarChart=b2,t.RadarSeries=ZJ,t.RangeAreaChart=x2,t.RangeAreaSeries=pJ,t.RangeColumn3dChart=w2,t.RangeColumn3dSeries=hJ,t.RangeColumnChart=S2,t.RangeColumnSeries=lJ,t.Rect3dMark=sJ,t.RectMark=jZ,t.RoseChart=A2,t.RoseLikeChart=v2,t.RoseLikeSeries=KJ,t.RoseSeries=qJ,t.RuleMark=WZ,t.SankeyChart=k2,t.SankeySeries=B1,t.ScatterChart=M2,t.ScatterSeries=XJ,t.ScrollBar=N2,t.SequenceChart=C2,t.SunburstChart=T2,t.SunburstSeries=m1,t.SymbolMark=ZZ,t.TextMark=NZ,t.ThemeManager=uX,t.Title=e5,t.Tooltip=M4,t.TreeMapChart=E2,t.TreeMapSeries=F1,t.VChart=fK,t.WaterfallChart=R2,t.WaterfallSeries=UZ,t.WordCloud3dChart=I2,t.WordCloud3dSeries=p0,t.WordCloudChart=B2,t.WordCloudSeries=u0,t.default=fK,t.version="1.1.0-beta.8",Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var s={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);sObject.prototype.toString.call(t)===`[object ${e}]`,o=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||a(t,"Boolean")},l=t=>"function"==typeof t,h=t=>null==t,c=t=>null!=t,d=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},u=t=>"object"==typeof t&&null!==t,p=function(t){if(!u(t)||!a(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},g=t=>void 0===t,f=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||a(t,"String")},m=t=>Array.isArray?Array.isArray(t):a(t,"Array"),y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},_=t=>a(t,"Date"),v=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||a(t,"Number")},b=t=>v(t)&&Number.isFinite(t),x=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),S=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),w=Object.prototype,A=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)},k=Object.prototype.hasOwnProperty;function M(t){if(h(t))return!0;if(y(t))return!t.length;const e=S(t);if("Map"===e||"Set"===e)return!t.size;if(A(t))return!Object.keys(t).length;for(const e in t)if(k.call(t,e))return!1;return!0}const C=(t,e,i)=>{const n=f(e)?e.split("."):e;for(let e=0;enull!=t&&T.call(t,e);function P(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,o){if(null===i)return null;if(0===o)return i;let l;if("object"!=typeof i)return i;if(m(i)?l=[]:a(i,"RegExp")?(l=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(l.lastIndex=i.lastIndex)):l=_(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(l)}for(const e in i)l[e]=t(i[e],o-1);return l}(t,i)}function R(t){let e;if(!c(t)||"object"!=typeof t)return t;const i=m(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:o(t)||v(t)||f(t)?t:_(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=R(n)}return e}function B(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(c(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];c(n[r])&&"object"==typeof n[r]?I(t,e,r,i):D(t,r,n[r])}}}}function I(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(m(r)){if(n)a=[];else if(m(s))a=s;else if(y(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!z(t[i],e[i]))return!1;return!0}if(!p(t))return!1;const i=F(t),n=F(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!z(t[s],e[s]))return!1}return!0}function H(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function U(t,e){if(!m(t)||!m(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Y(t,e,i){c(e)||(e=t,t=0),c(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function $(t){return Number(t)}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function q(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(h(n)&&(n=t.length);i>>1;X(t[s],e)>0?n=s:i=s+1}return i}const Z=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(X)),K(i,.5)},J=Math.sqrt(50),Q=Math.sqrt(10),et=Math.sqrt(2);function it(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=J?s*=10:r>=Q?s*=5:r>=et&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:nt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function at(t,e,i,n){return t>e&&!rt(t,e,i,n)}function ot(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},ht=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?lt(n,r)+s:"center"===i?lt(n,Math.floor(r/2))+s+lt(n,Math.ceil(r/2)):s+lt(n,r)},ct=function(t,e,i){return ti?i:t},dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,p=!0;const g=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function y(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function _(){const t=Date.now();if(y(t))return v(t);o=m(_,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function v(t){return o=void 0,p&&n?f(t):(n=s=void 0,a)}function x(){const t=Date.now(),i=y(t);for(var r=arguments.length,d=new Array(r),p=0;pt*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const _t=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vt=new RegExp(_t.source,"g");const bt=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function xt(t){if(t instanceof Date)return t;if(f(t)){const e=bt.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return h(t)?new Date(NaN):new Date(Math.round(t))}const St=1e-12,wt=Math.PI,At=wt/2,kt=2*wt,Mt=2*Math.PI,Ct=Math.abs,Tt=Math.atan2,Et=Math.cos,Pt=Math.max,Rt=Math.min,Bt=Math.sin,It=Math.sqrt,Dt=Math.pow;function Lt(t){return t>1?0:t<-1?wt:Math.acos(t)}function Ot(t){return t>=1?At:t<=-1?-At:Math.asin(t)}function Ft(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function zt(t,e){return t[0]*e[1]-t[1]*e[0]}class Ht{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ht(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return v(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return v(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class jt{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Ht((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return m(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Nt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class Wt extends Vt{}function Ut(t){return t*(Math.PI/180)}function Gt(t){return 180*t/Math.PI}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-kt;)t+=kt;else if(t>0)for(;t>kt;)t-=kt;return t},Xt=Yt;function $t(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Kt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new qt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new qt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new qt(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=Gt(r.rotateDeg),r}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return v(t)?new re(t>>16,t>>8&255,255&t,1):m(t)?new re(t[0],t[1],t[2]):new re(255,255,255)}let se=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(c(te[t]))return function(t){return v(t)?new re(t>>>24,t>>>16&255,t>>>8&255,255&t):m(t)?new re(t[0],t[1],t[2],t[3]):new re(255,255,255,1)}(te[t]);if(c(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new re((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new re(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new re(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new re(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new re(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=Zt(h(t)?s.h:ct(t,0,360),h(e)?s.s:e>=0&&e<=1?100*e:e,h(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new re(r.r,r.g,r.b,n),this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}};class re{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),c(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ae(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new re(e,c,d,l*(1-t)+h*t)}},rgbToHex:oe,rgbToHsl:Jt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ye;function _e(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}var be;function xe(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me]),ce>fe||deye||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function Ae(t){return t/180*Math.PI}function ke(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?t.angle:Ae(t.angle),n=ke(t);return[we({x:t.x1,y:t.y1},i,n),we({x:t.x2,y:t.y1},i,n),we({x:t.x2,y:t.y2},i,n),we({x:t.x1,y:t.y2},i,n)]}let Ce,Te,Ee,Pe;function Re(t){return Ce=1/0,Te=1/0,Ee=-1/0,Pe=-1/0,t.forEach((t=>{Ce>t.x&&(Ce=t.x),Eet.y&&(Te=t.y),Pee&&r>n||rs?o:0}function Oe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class ze{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),c(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=c(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(h(this._canvas)&&(c(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),h(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&c(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),h(this._context)&&c(this._canvas)){const t=this._canvas.getContext("2d");c(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!h(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(h(t))return{width:0,height:0};if(h(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let c;try{const h=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});c={width:h.width(),height:h.height()}}catch(e){this._notSupportVRender=!0,c=this.measureWithNaiveCanvas(t)}return c}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(h(this._numberCharSize)){const t=this._standardMethod(ze.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ze.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return h(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ze.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(h(this._letterCharSize)){const t=this._standardMethod(ze.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ze.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return c(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){c(this._canvas)&&(this._canvas=null),c(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}ze.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ze.NUMBERS_CHAR_SET="0123456789",ze.FULL_SIZE_CHAR="字";const He="undefined"!=typeof console;function je(t,e,i){const n=[e].concat([].slice.call(i));He&&console[t].apply(console,n)}var Ne;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(Ne||(Ne={}));class Ve{static getInstance(t,e){return Ve._instance&&v(t)?Ve._instance.level(t):Ve._instance||(Ve._instance=new Ve(t,e)),Ve._instance}static setInstance(t){return Ve._instance=t}static setInstanceLevel(t){Ve._instance?Ve._instance.level(t):Ve._instance=new Ve(t)}static clearInstance(){Ve._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ne.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Ne.Info}canLogDebug(){return this._level>=Ne.Debug}canLogError(){return this._level>=Ne.Error}canLogWarn(){return this._level>=Ne.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Ne.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):je(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Ne.Warn&&je(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Ne.Info&&je(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Ne.Debug&&je(this._method||"log","DEBUG",e),this}}function We(t){if(b(t))return[t,t,t,t];if(m(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(d(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Ue(t){return t?"getUTCFullYear":"getFullYear"}function Ge(t){return t?"getUTCMonth":"getMonth"}function Ye(t){return t?"getUTCDate":"getDate"}function Xe(t){return t?"getUTCHours":"getHours"}function $e(t){return t?"getUTCMinutes":"getMinutes"}function Ke(t){return t?"getUTCSeconds":"getSeconds"}function qe(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Ze(t){return t?"setUTCFullYear":"setFullYear"}Ve._instance=null;const Je=1e3,Qe=6e4,ti=36e5,ei=24*ti,ii=31*ei,ni=365*ei,si=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),ri=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),ai=(t,e)=>e.getFullYear()-t.getFullYear(),oi=t=>t.getFullYear(),li=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),hi=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),ci=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),di=t=>t.getUTCFullYear(),ui=t=>(t.setDate(1),t.setHours(0,0,0,0),t),pi=(t,e)=>(t.setMonth(t.getMonth()+e),t),gi=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),fi=t=>t.getMonth(),mi=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),yi=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),_i=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),vi=t=>t.getUTCMonth(),bi=t=>(t.setHours(0,0,0,0),t),xi=(t,e)=>(t.setDate(t.getDate()+e),t),Si=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ei,wi=t=>t.getDate()-1,Ai=t=>(t.setUTCHours(0,0,0,0),t),ki=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Mi=(t,e)=>(+e-+t)/ei,Ci=t=>t.getUTCDate()-1,Ti=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),Ei=(t,e)=>(t.setHours(t.getHours()+e),t),Pi=(t,e)=>(+e-+t)/ti,Ri=t=>t.getHours(),Bi=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),Ii=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Di=t=>t.getUTCHours(),Li=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),Oi=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Fi=(t,e)=>(+e-+t)/6e4,zi=t=>t.getMinutes(),Hi=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),ji=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Ni=t=>t.getUTCMinutes(),Vi=t=>(t.setTime(+t-t.getMilliseconds()),t),Wi=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ui=(t,e)=>(+e-+t)/1e3,Gi=t=>t.getSeconds(),Yi=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),Xi=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),$i=t=>t.getUTCSeconds(),Ki=t=>t,qi=(t,e)=>(t.setTime(+t+e),t),Zi=(t,e)=>+e-+t,Ji=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},Qi=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Ji(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Ji(h,c)}};function tn(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function en(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var nn=6371008.8,sn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*nn,kilometers:6371.0088,kilometres:6371.0088,meters:nn,metres:nn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:nn/1852,radians:1,yards:6967335.223679999};function rn(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function an(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function on(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ln(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Ut(t[0]),r=Ut(t[1]),a=Ut(i),o=function(t,e){void 0===e&&(e="kilometers");var i=sn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Gt(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Gt(l)}}const hn=t=>t;var cn,dn;t.RenderModeEnum=void 0,(cn=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",cn["mobile-browser"]="mobile-browser",cn.node="node",cn.worker="worker",cn.miniApp="miniApp",cn["desktop-miniApp"]="desktop-miniApp",cn.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.customMark="customMark"}(dn||(dn={}));for(let t=0;t<256;t++)t.toString(16);const un=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};function pn(){return new gn}function gn(){this.reset()}gn.prototype={constructor:gn,reset:function(){this.s=this.t=0},add:function(t){mn(fn,t,this.t),mn(this,fn.s,this.s),this.s?this.t+=fn.t:this.s=fn.t},valueOf:function(){return this.s}};var fn=new gn;function mn(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var yn=1e-6,_n=Math.PI,vn=_n/2,bn=_n/4,xn=2*_n,Sn=180/_n,wn=_n/180,An=Math.abs,kn=Math.atan,Mn=Math.atan2,Cn=Math.cos,Tn=Math.exp,En=Math.log,Pn=Math.pow,Rn=Math.sin,Bn=Math.sign||function(t){return t>0?1:t<0?-1:0},In=Math.sqrt,Dn=Math.tan;function Ln(t){return t>1?0:t<-1?_n:Math.acos(t)}function On(t){return t>1?vn:t<-1?-vn:Math.asin(t)}function Fn(){}function zn(t,e){t&&jn.hasOwnProperty(t.type)&&jn[t.type](t,e)}var Hn={Feature:function(t,e){zn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++n_n?t+Math.round(-t/xn)*xn:t,e]}function Qn(t,e,i){return(t%=xn)?e||i?Zn(es(t),is(e,i)):es(t):e||i?is(e,i):Jn}function ts(t){return function(e,i){return[(e+=t)>_n?e-xn:e<-_n?e+xn:e,i]}}function es(t){var e=ts(t);return e.invert=ts(-t),e}function is(t,e){var i=Cn(t),n=Rn(t),s=Cn(e),r=Rn(e);function a(t,e){var a=Cn(e),o=Cn(t)*a,l=Rn(t)*a,h=Rn(e),c=h*i+o*n;return[Mn(l*s-c*r,o*i-h*n),On(c*s+l*r)]}return a.invert=function(t,e){var a=Cn(e),o=Cn(t)*a,l=Rn(t)*a,h=Rn(e),c=h*s-l*r;return[Mn(l*s+h*r,o*i+c*n),On(c*i-o*n)]},a}function ns(t,e){(e=Gn(e))[0]-=t,qn(e);var i=Ln(-e[1]);return((-e[2]<0?-i:i)+xn-yn)%xn}function ss(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:Fn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function rs(t,e){return An(t[0]-e[0])=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function ls(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function us(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function ps(t,e,i,n){return function(s){var r,a,o,l=e(s),h=ss(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=y,u.lineStart=_,u.lineEnd=v,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=us(a);var t=function(t,e){var i=cs(e),n=e[1],s=Rn(n),r=[Rn(i),-Cn(i),0],a=0,o=0;hs.reset(),1===s?n=vn+yn:-1===s&&(n=-vn-yn);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>_n,C=f*x;if(hs.add(Mn(C*A*Rn(k),m*S+C*Cn(k))),a+=M?w+A*xn:w,M^p>=i^v>=i){var T=Xn(Gn(u),Gn(_));qn(T);var E=Xn(r,T);qn(E);var P=(M^w>=0?-1:1)*On(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-yn||a0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(gs))}return u}}function gs(t){return t.length>1}function fs(t,e){return((t=t.x)[0]<0?t[1]-vn-yn:vn-t[1])-((e=e.x)[0]<0?e[1]-vn-yn:vn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return ds(e(t),i)})}(ds);var ms=ps((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?_n:-_n,l=An(r-i);An(l-_n)0?vn:-vn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=_n&&(An(i-s)yn?kn((Rn(e)*(r=Cn(n))*Rn(i)-Rn(n)*(s=Cn(e))*Rn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*vn,n.point(-_n,s),n.point(0,s),n.point(_n,s),n.point(_n,0),n.point(_n,-s),n.point(0,-s),n.point(-_n,-s),n.point(-_n,0),n.point(-_n,s);else if(An(t[0]-e[0])>yn){var r=t[0]0,s=An(e)>yn;function r(t,i){return Cn(t)*Cn(i)>e}function a(t,i,n){var s=[1,0,0],r=Xn(Gn(t),Gn(i)),a=Yn(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=Xn(s,r),u=Kn(s,h);$n(u,Kn(r,c));var p=d,g=Yn(u,p),f=Yn(p,p),m=g*g-f*(Yn(u,u)-1);if(!(m<0)){var y=In(m),_=Kn(p,(-g-y)/f);if($n(_,u),_=Un(_),!n)return _;var v,b=t[0],x=i[0],S=t[1],w=i[1];x0^_[1]<(An(_[0]-b)_n^(b<=_[0]&&_[0]<=x)){var M=Kn(p,(-g+y)/f);return $n(M,u),[_,Un(M)]}}}function o(e,i){var s=n?t:_n-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return ps(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=n?f?0:o(d,u):f?o(d+(d<0?_n:-_n),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||rs(e,p)||rs(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(s&&e&&n^f){var y;m&i||!(y=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!f||e&&rs(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Cn(e),o=Rn(e),l=n*i;null==s?(s=e+n*xn,r=e-l/2):(s=ns(a,s),r=ns(a,r),(n>0?sr)&&(s+=n*xn));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return An(n[0]-t)0?0:3:An(n[0]-i)0?2:1:An(n[1]-e)0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,y,_,v=a,b=ss(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);y=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,s=(l=us(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&os(l,o,e,r,a),a.polygonEnd());v=a,l=h=c=null}};function S(t,e){s(t,e)&&v.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),y)d=r,u=a,p=o,y=!1,o&&(v.lineStart(),v.point(r,a));else if(o&&m)v.point(r,a);else{var l=[g=Math.max(vs,Math.min(_s,g)),f=Math.max(vs,Math.min(_s,f))],b=[r=Math.max(vs,Math.min(_s,r)),a=Math.max(vs,Math.min(_s,a))];!function(t,e,i,n,s,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=s-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,n)?o&&(v.lineStart(),v.point(r,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),o||v.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function xs(t){return t}var Ss,ws,As,ks,Ms=pn(),Cs=pn(),Ts={point:Fn,lineStart:Fn,lineEnd:Fn,polygonStart:function(){Ts.lineStart=Es,Ts.lineEnd=Bs},polygonEnd:function(){Ts.lineStart=Ts.lineEnd=Ts.point=Fn,Ms.add(An(Cs)),Cs.reset()},result:function(){var t=Ms/2;return Ms.reset(),t}};function Es(){Ts.point=Ps}function Ps(t,e){Ts.point=Rs,Ss=As=t,ws=ks=e}function Rs(t,e){Cs.add(ks*t-As*e),As=t,ks=e}function Bs(){Rs(Ss,ws)}var Is=Ts,Ds=1/0,Ls=Ds,Os=-Ds,Fs=Os,zs={point:function(t,e){tOs&&(Os=t);eFs&&(Fs=e)},lineStart:Fn,lineEnd:Fn,polygonStart:Fn,polygonEnd:Fn,result:function(){var t=[[Ds,Ls],[Os,Fs]];return Os=Fs=-(Ls=Ds=1/0),t}};var Hs,js,Ns,Vs,Ws=zs,Us=0,Gs=0,Ys=0,Xs=0,$s=0,Ks=0,qs=0,Zs=0,Js=0,Qs={point:tr,lineStart:er,lineEnd:sr,polygonStart:function(){Qs.lineStart=rr,Qs.lineEnd=ar},polygonEnd:function(){Qs.point=tr,Qs.lineStart=er,Qs.lineEnd=sr},result:function(){var t=Js?[qs/Js,Zs/Js]:Ks?[Xs/Ks,$s/Ks]:Ys?[Us/Ys,Gs/Ys]:[NaN,NaN];return Us=Gs=Ys=Xs=$s=Ks=qs=Zs=Js=0,t}};function tr(t,e){Us+=t,Gs+=e,++Ys}function er(){Qs.point=ir}function ir(t,e){Qs.point=nr,tr(Ns=t,Vs=e)}function nr(t,e){var i=t-Ns,n=e-Vs,s=In(i*i+n*n);Xs+=s*(Ns+t)/2,$s+=s*(Vs+e)/2,Ks+=s,tr(Ns=t,Vs=e)}function sr(){Qs.point=tr}function rr(){Qs.point=or}function ar(){lr(Hs,js)}function or(t,e){Qs.point=lr,tr(Hs=Ns=t,js=Vs=e)}function lr(t,e){var i=t-Ns,n=e-Vs,s=In(i*i+n*n);Xs+=s*(Ns+t)/2,$s+=s*(Vs+e)/2,Ks+=s,qs+=(s=Vs*t-Ns*e)*(Ns+t),Zs+=s*(Vs+e),Js+=3*s,tr(Ns=t,Vs=e)}var hr=Qs;function cr(t){this._context=t}cr.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,xn)}},result:Fn};var dr,ur,pr,gr,fr,mr=pn(),yr={point:Fn,lineStart:function(){yr.point=_r},lineEnd:function(){dr&&vr(ur,pr),yr.point=Fn},polygonStart:function(){dr=!0},polygonEnd:function(){dr=null},result:function(){var t=+mr;return mr.reset(),t}};function _r(t,e){yr.point=vr,ur=gr=t,pr=fr=e}function vr(t,e){gr-=t,fr-=e,mr.add(In(gr*gr+fr*fr)),gr=t,fr=e}var br=yr;function xr(){this._string=[]}function Sr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function wr(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Wn(t,i(n))),n.result()}return r.area=function(t){return Wn(t,i(Is)),Is.result()},r.measure=function(t){return Wn(t,i(br)),br.result()},r.bounds=function(t){return Wn(t,i(Ws)),Ws.result()},r.centroid=function(t){return Wn(t,i(hr)),hr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new xr):new cr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function Ar(t){return function(e){var i=new kr;for(var n in t)i[n]=t[n];return i.stream=e,i}}function kr(){}function Mr(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Wn(i,t.stream(Ws)),e(Ws.result()),null!=n&&t.clipExtent(n),t}function Cr(t,e,i){return Mr(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Tr(t,e,i){return Cr(t,[[0,0],e],i)}function Er(t,e,i){return Mr(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Pr(t,e,i){return Mr(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}xr.prototype={_radius:4.5,_circle:Sr(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Sr(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},kr.prototype={constructor:kr,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Rr=16,Br=Cn(30*wn);function Ir(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,m){var y=h-n,_=c-s,v=y*y+_*_;if(v>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=In(b*b+x*x+S*S),A=On(S/=w),k=An(An(S)-1)e||An((y*E+_*P)/v-.5)>.3||a*u+o*p+l*g2?t[2]%360*wn:0,E()):[m*Sn,y*Sn,_*Sn]},C.angle=function(t){return arguments.length?(v=t%360*wn,E()):v*Sn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Ir(o,M=t*t),P()):In(M)},C.fitExtent=function(t,e){return Cr(C,t,e)},C.fitSize=function(t,e){return Tr(C,t,e)},C.fitWidth=function(t,e){return Er(C,t,e)},C.fitHeight=function(t,e){return Pr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function Hr(t){var e=0,i=_n/3,n=zr(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*wn,i=t[1]*wn):[e*Sn,i*Sn]},s}function jr(t,e){var i=Rn(t),n=(i+Rn(e))/2;if(An(n)2?t[2]*wn:0),e.invert=function(e){return(e=t.invert(e[0]*wn,e[1]*wn))[0]*=Sn,e[1]*=Sn,e},e}(s.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Xr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function qr(t){return Dn((vn+t)/2)}function Zr(t,e){var i=Cn(t),n=t===e?Rn(t):En(i/Cn(e))/En(qr(e)/qr(t)),s=i*Pn(qr(t),n)/n;if(!n)return Xr;function r(t,e){s>0?e<-vn+yn&&(e=-vn+yn):e>vn-yn&&(e=vn-yn);var i=s/Pn(qr(e),n);return[i*Rn(n*t),s-i*Cn(n*t)]}return r.invert=function(t,e){var i=s-e,r=Bn(n)*In(t*t+i*i),a=Mn(t,An(i))*Bn(i);return i*n<0&&(a-=_n*Bn(t)*Bn(i)),[a/n,2*kn(Pn(s/r,1/n))-vn]},r}function Jr(t,e){return[t,e]}function Qr(t,e){var i=Cn(t),n=t===e?Rn(t):(i-Cn(e))/(e-t),s=i/n+t;if(An(n)yn&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},la.invert=Ur(On),ha.invert=Ur((function(t){return 2*kn(t)})),ca.invert=function(t,e){return[-e,2*kn(Tn(t))-vn]},$r().translate([0,0]).center([0,0]).scale(63781);var da=Object.prototype.hasOwnProperty;function ua(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^ma[2]^ma[3])}function _a(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=ua(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return ya(r[t])}function S(t,e){return pa(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=xa(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ba(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Ia(t,e)}))}:Ia(t,e)}function Ia(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=Da(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function Da(t,e){var i=Pa(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function za(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Ra(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=Ha(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=Ga(t.slice(0,n),e),o=Ga(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Ya=Ga;!function(t){var e=Ya;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=$a(Za,e),{tolerance:n}=i;return Xa(t,n)};var Qa;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Qa||(Qa={}));const to=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},eo=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+ao(e,6):ao(e,4))+"-"+ao(t.getUTCMonth()+1,2)+"-"+ao(t.getUTCDate(),2)+(r?"T"+ao(i,2)+":"+ao(n,2)+":"+ao(s,2)+"."+ao(r,3)+"Z":s?"T"+ao(i,2)+":"+ao(n,2)+":"+ao(s,2)+"Z":n||i?"T"+ao(i,2)+":"+ao(n,2)+"Z":"")}function lo(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return no;if(h)return h=!1,io;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Qa.DSV;const i=$a(uo,e),{delimiter:n}=i;if(!f(n))throw new TypeError("Invalid delimiter: must be a string!");return lo(n).parse(t)},go=function(t){return(arguments.length>2?arguments[2]:void 0).type=Qa.DSV,ho(t)},fo=function(t){return(arguments.length>2?arguments[2]:void 0).type=Qa.DSV,co(t)};function mo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return yo(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return yo(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return vo(t);default:throw new Error("unknown GeoJSON type")}}function yo(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=_o(t.properties),e.geometry=vo(t.geometry),e}function _o(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=_o(n):e[i]=n})),e):e}function vo(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return vo(t)})),e):(e.coordinates=bo(t.coordinates),e)}function bo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return bo(t)}))}function xo(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function So(t){for(var e,i,n=xo(t),s=0,r=1;r0}function wo(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=mo(t));var r=[];switch(t.type){case"GeometryCollection":return Ao(t,(function(t){Mo(t,n)})),t;case"FeatureCollection":return wo(t,(function(t){wo(Mo(t,n),(function(t){r.push(t)}))})),an(r)}return Mo(t,n)}function Mo(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Ao(t,(function(t){Mo(t,e)})),t;case"LineString":return Co(xo(t),e),t;case"Polygon":return To(xo(t),e),t;case"MultiLineString":return xo(t).forEach((function(t){Co(t,e)})),t;case"MultiPolygon":return xo(t).forEach((function(t){To(t,e)})),t;case"Point":case"MultiPoint":return t}}function Co(t,e){So(t)===e&&t.reverse()}function To(t,e){So(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Eo(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Io=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Qa.GEO;const i=$a(Ro,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Bo(t))})):e.push(Bo(t))})),e})(t);let o=t.features;return a&&(o=ko(t,{reverse:!d(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Po.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Po.bounds(t);t.bbox=e}})),t.features=o,t},Do={},Lo=(t,e,i)=>{i.type=Qa.GEO;const n=$a(Ro,Do,e),{object:s}=n;if(!f(s))throw new TypeError("Invalid object: must be a string!");const r=Ba(t,t.objects[s]);return Io(r,n,i)},Oo=(t,e,i)=>{const n=!o(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!m(t))throw new TypeError("Invalid data: must be DataView array!");return m(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Fo=0;function zo(){return Fo>1e8&&(Fo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+Fo++}class Ho{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new r,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:zo("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){this.transformMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const jo="_data-view-diff-rank";class No{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new r,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:zo("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",eo),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=R(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[jo]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[jo]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[jo][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear};utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear};parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1};parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1};parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1};parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1};parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1};parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1};parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1};parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Wo(t,e){const i=new Set(N(t)),n=new Set(N(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Uo}=le,Go=(t,e)=>(l(Xo.warnHandler)&&Xo.warnHandler.call(null,t,e),e?Ve.getInstance().warn(`[VChart warn]: ${t}`,e):Ve.getInstance().warn(`[VChart warn]: ${t}`)),Yo=(t,e,i)=>{const n=new Error(t);return Ve.getInstance().error(`[VChart error]: ${n}`,e)},Xo={silent:!1,warnHandler:!1,errorHandler:!1},$o="undefined"!=typeof window&&void 0!==window.document,Ko=$o&&globalThis.document;function qo(t){return("desktop-browser"===t||"mobile-browser"===t)&&$o}function Zo(t){return"miniApp"===t||"mobile-browser"===t}function Jo(t){return t.includes("miniApp")||"lynx"===t}let Qo=0;function tl(){return Qo>=9999999&&(Qo=0),Qo++}function el(t){return!h(t)&&(!!v(t)||+t==+t)}function il(t){return!(!t||0===t.length)&&(!h(t[0])&&!h(t[0].dataId)&&m(t[0].fields))}const nl=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const sl=t=>e=>C(e,t),rl=t=>{Ve.getInstance().error(t)},al=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||rl("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&rl("Access path missing closing bracket: "+t),a&&rl("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return nl((i&&i.get||sl)(n),[s],e||s)},ol=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m(t)){const n=t.map((t=>al(t,e,i)));return t=>n.map((e=>e(t)))}return al(t,e,i)};ol("id");const ll=nl((function(t){return t}),[],"identity"),hl=nl((function(){return 0}),[],"zero");nl((function(){return 1}),[],"one"),nl((function(){return!0}),[],"true"),nl((function(){return!1}),[],"false"),nl((function(){return{}}),[],"emptyObject");const cl=(t,e)=>{if((te||h(e))&&!h(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},dl=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>cl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=N(e)||[],s=[],r=[],a={},o=i.comparator||dl;return N(t).forEach(((t,e)=>{if(h(t))return;s.push("desc"===n[e]?-1:1);const o=l(t)?t:ol(t,null,i);var c;r.push(o),(c=o,(h(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:nl(o(r,s),Object.keys(a))},pl=(t,e)=>{const i=l(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(h(e)||h(i))return h(e)&&h(i);if(!u(e)&&!u(i))return e===i;const s=m(e)?e:e[t],r=m(i)?i:i[t];return s===r||!1!==n&&(m(r)?!(!m(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!d(r)&&!(!d(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>gl(t,r,s)))))},fl=(t,e)=>h(t)?e:Math.min(f(t)?e*parseFloat(t)/100:t,e);function ml(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!h(s)&&(s=+s)>=s&&!h(r)&&(r=+r)>=r&&n(s,r,++a)}))}function yl(t,e,i,n,s){let r=0,a=0;return ml(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function _l(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;ml(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:yl(t,e,i,s,h)}}const vl=rt;function bl(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const xl=t=>b(t)?Ut(t):null,Sl=t=>b(t)?Gt(t):null;function wl(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Al(t,e,i,n){const s=wl({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function kl(t){return 3===t||4===t}function Ml(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}function Cl(t,e){const i=e?+t[0][e]:+t[0];if(!b(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&n{const n=e?+i[e]:+i;return b(n)&&n>t&&(t=n),t}),i)}function El(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;b(s)&&(i+=s,n++)}));return i/n}function Pl(t,e){const i=El(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Rl(t){let e="center",i="middle";return e=(t=bl(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}}function Bl(t,e){const i=Il(t),n=Il(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function Il(t,e={x:0,y:0}){return jt.distancePP(t,e)}function Dl(t,e,i){let n=!1;if(e&&l(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function Ll(t){return function(e){let i;return i=m(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var Ol;function Fl(t){switch(t){case Ol.Linear:case Ol.Log:case Ol.Pow:case Ol.Sqrt:case Ol.Symlog:case Ol.Time:return!0;default:return!1}}function zl(t){switch(t){case Ol.Linear:case Ol.Log:case Ol.Pow:case Ol.Sqrt:case Ol.Symlog:case Ol.Time:case Ol.Ordinal:case Ol.Point:case Ol.Band:return!0;default:return!1}}function Hl(t){switch(t){case Ol.Ordinal:case Ol.Point:case Ol.Band:return!0;default:return!1}}!function(t){t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(Ol||(Ol={}));class jl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Nl=Symbol("implicit");class Vl extends jl{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Ol.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Nl}clone(){return(new Vl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!h(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==Nl)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Gl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),Yl=t=>t<0?-t*t:t*t,Xl=t=>-Math.log(-t),$l=t=>-Math.exp(-t),Kl=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ql=t=>10===t?Kl:t===Math.E?Math.exp:e=>Math.pow(t,e),Zl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Jl=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Ql=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function th(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function eh(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function ih(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class rh extends Vl{constructor(t){super(),this.type=Ol.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Y(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[$(t[0]),$(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[$(t[0]),$(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:sh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return sh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}clone(){return new rh(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:ah}=le;function oh(t,e){const i=typeof e;let n;if(h(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=se.parseColorString(e)){const e=ah(se.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof re?ah(t,e):e instanceof se?ah(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class lh extends jl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Wl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Wl,this._piecewise=eh,this._interpolate=oh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,$);return this._domain=i,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=yt,this.rescale(e)}rescale(t){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=ut(this._domain[0],this._domain[n-1])),this._piecewise=n>2?ih:eh,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Wl),this.rescale(i)):this._clamp!==Wl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const hh=Math.sqrt(50),ch=Math.sqrt(10),dh=Math.sqrt(2);function uh(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=hh?a=10:r>=ch?a=5:r>=dh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function gh(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=ph(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class yh extends lh{constructor(){super(...arguments),this.type=Ol.Linear}clone(){return(new yh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return uh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return gh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=mh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=mh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=mh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function _h(t){return e=>-t(-e)}class vh extends lh{constructor(){super(Zl(10),ql(10)),this.type=Ol.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new vh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){if(t)return this;super.rescale();const e=Zl(this._base),i=ql(this._base);return this._domain[0]<0?(this._logs=_h(e),this._pows=_h(i),this.transformer=Xl,this.untransformer=$l):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Wl}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.lengththis._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}}class bh extends rh{constructor(t){super(!1),this.type=Ol.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class xh extends yh{constructor(){super(),this.type=Ol.Pow,this._exponent=1}clone(){return(new xh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=Wl,this.untransformer=Wl):.5===this._exponent?(this.transformer=Gl,this.untransformer=Yl):(this.transformer=Ul(this._exponent),this.untransformer=Ul(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function Sh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class wh{constructor(){this.type=Ol.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return Sh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new Ah).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return uh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return gh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return fh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=mh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=mh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=mh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class kh extends yh{constructor(){super(Gl,Yl),this.type=Ol.Sqrt}clone(){return(new kh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Mh extends yh{constructor(){super(Jl(1),Ql(1)),this.type=Ol.Symlog,this._const=1}clone(){return(new Mh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=Jl(t),this.untransformer=Ql(t),this.rescale(e)):this._const}}class Ch{constructor(){this.type=Ol.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!h(t)&&b(+t)?this._range[q(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new Ch).domain(this._domain).range(this._range).unknown(this._unknown)}}const Th=[["second",1,Je],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,Qe],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,ti],["hour",3,3*ti],["hour",6,6*ti],["hour",12,12*ti],["day",1,ei],["day",2,2*ei],["day",7,7*ei],["month",1,ii],["month",3,3*ii],["month",6,6*ii],["year",1,365*ei]];function Eh(t){return+xt(t)}function Ph(t,e,i,n){const s=(+e-+t)/i,r=q(Th.map((t=>t[2])),s);if(r===Th.length){const s=Math.max(it(+t/ni,+e/ni,i),1),r=t=>(t[Ze(n)](Math.floor(t[Ue(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Ze(n)](t[Ue(n)]()+e*s),t);return{floor:r,offset:a,ceil:Ji(r,a)}}if(0===r){const n=Math.max(it(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Ji(s,r)}}const[a,o]=Th[s/Th[r-1][2]"year"===t&&e?{floor:li,offset:hi,count:ci,field:di}:"month"===t&&e?{floor:mi,offset:yi,count:_i,field:vi}:"day"===t&&e?{floor:Ai,offset:ki,count:Mi,field:Ci}:"hour"===t&&e?{floor:Bi,offset:Ii,count:Pi,field:Di}:"minute"===t&&e?{floor:Hi,offset:ji,count:Fi,field:Ni}:"second"===t&&e?{floor:Yi,offset:Xi,count:Ui,field:$i}:"year"===t?{floor:si,offset:ri,count:ai,field:oi}:"month"===t?{floor:ui,offset:pi,count:gi,field:fi}:"day"===t?{floor:bi,offset:xi,count:Si,field:wi}:"hour"===t?{floor:Ti,offset:Ei,count:Pi,field:Ri}:"minute"===t?{floor:Li,offset:Oi,count:Fi,field:zi}:"second"===t?{floor:Vi,offset:Wi,count:Ui,field:Gi}:{floor:Ki,offset:qi,count:Zi})(a,n);return Qi(o,l)}class Rh extends lh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=Ol.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(xt);const i=Array.from(t,Eh);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=xt(t),s=e[Ue(n)](),r=e[Ge(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Ye(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[Xe(n)](),c=(h-1)%12+1,d=e[$e(n)](),u=e[Ke(n)](),p=e[qe(n)]();return(i||"").replace(/YYYY/g,ht(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,ht(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,ht(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,ht(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,ht(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,ht(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,ht(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,ht(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Rh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(v(t)||h(t))&&(i=Ph(e[0],e[e.length-1],h(t)?10:t,this._isUtc)),i&&this.domain(nh(e,i)),this}utc(){return this._isUtc}}function Bh(t,e){const i=c(e)?t?.[e]??t?.default:t?.default;if(!i||m(i))return i;if(d(i)){const{dataScheme:n}=i;return n?Fh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>Oh(i)?Dh(t,i,e):i)).filter(c)}))):n.map((i=>Oh(i)?Dh(t,i,e):i)).filter(c):[]}return[]}function Ih(t,e){return Fh(t)?t.find((t=>c(t.isAvailable)?l(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!c(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function Dh(t,e,i){const n=c(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!c(e.a)&&!c(e.l)||!f(s))return s;let r=new Uo(s);if(c(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Jt(t,i,n),o=Zt(s,a,e.l),l=new Uo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return c(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Lh=(t,e,i)=>{if(Oh(t)&&e){const n=Dh(e,t,i);if(n)return n}return t};function Oh(t){return d(t)&&"palette"===t.type&&!!t.key}function Fh(t){return!!m(t)&&t.every((t=>c(t.scheme)))}class zh extends Vl{_range;range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Fh(this._range))return void super.range(this._range);const t=Ih(this._range,this._domain);super.range(t)}}const Hh={linear:yh,band:rh,point:bh,ordinal:Vl,threshold:Ch,colorOrdinal:zh};function jh(t){const e=Hh[t];return e?new e:null}function Nh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Vh(t){return c(t?.field)&&c(t?.scale)}var Wh;function Uh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Gh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Yh(t){return!!f(t)&&(!!t.endsWith("%")&&el(t.substring(0,t.length-1)))}function Xh(t,e,i){return v(t)?t:Yh(t)?Number(t.substring(0,t.length-1))*e/100:l(t)?t(i):0}function $h(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>v(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=Xh(t[s],e.size,i)}))})),n}function Kh(t){let e={};return m(t)?(h(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),h(t[1])||(e.left=e.right=t[1]),h(t[2])||(e.bottom=t[2]),h(t[3])||(e.left=t[3]),e):v(t)||Yh(t)||l(t)?(e.top=e.left=e.bottom=e.right=t,e):(d(t)&&(e={...t}),e)}function qh(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function Zh(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=Zh(t[n],e)}return i}return m(t)?t.map((t=>Zh(t,e))):t}function Jh(t){const e=t;let i;if(!c(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof No||e.every((t=>i.includes(t)))}(e))return e;const n=m(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:o(e)||v(e)||f(e)?e:_(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=Jh(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(Wh||(Wh={}));var Qh=function(t){return t&&t.Math==Math&&t},tc=Qh("object"==typeof globalThis&&globalThis)||Qh("object"==typeof window&&window)||Qh("object"==typeof self&&self)||Qh("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),ec={},ic=function(t){try{return!!t()}catch(t){return!0}},nc=!ic((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),sc=!ic((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),rc=sc,ac=Function.prototype.call,oc=rc?ac.bind(ac):function(){return ac.apply(ac,arguments)},lc={},hc={}.propertyIsEnumerable,cc=Object.getOwnPropertyDescriptor,dc=cc&&!hc.call({1:2},1);lc.f=dc?function(t){var e=cc(this,t);return!!e&&e.enumerable}:hc;var uc,pc,gc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},fc=sc,mc=Function.prototype,yc=mc.call,_c=fc&&mc.bind.bind(yc,yc),vc=fc?_c:function(t){return function(){return yc.apply(t,arguments)}},bc=vc,xc=bc({}.toString),Sc=bc("".slice),wc=function(t){return Sc(xc(t),8,-1)},Ac=ic,kc=wc,Mc=Object,Cc=vc("".split),Tc=Ac((function(){return!Mc("z").propertyIsEnumerable(0)}))?function(t){return"String"==kc(t)?Cc(t,""):Mc(t)}:Mc,Ec=function(t){return null==t},Pc=Ec,Rc=TypeError,Bc=function(t){if(Pc(t))throw Rc("Can't call method on "+t);return t},Ic=Tc,Dc=Bc,Lc=function(t){return Ic(Dc(t))},Oc="object"==typeof document&&document.all,Fc={all:Oc,IS_HTMLDDA:void 0===Oc&&void 0!==Oc},zc=Fc.all,Hc=Fc.IS_HTMLDDA?function(t){return"function"==typeof t||t===zc}:function(t){return"function"==typeof t},jc=Hc,Nc=Fc.all,Vc=Fc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:jc(t)||t===Nc}:function(t){return"object"==typeof t?null!==t:jc(t)},Wc=tc,Uc=Hc,Gc=function(t,e){return arguments.length<2?(i=Wc[t],Uc(i)?i:void 0):Wc[t]&&Wc[t][e];var i},Yc=vc({}.isPrototypeOf),Xc=tc,$c="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Kc=Xc.process,qc=Xc.Deno,Zc=Kc&&Kc.versions||qc&&qc.version,Jc=Zc&&Zc.v8;Jc&&(pc=(uc=Jc.split("."))[0]>0&&uc[0]<4?1:+(uc[0]+uc[1])),!pc&&$c&&(!(uc=$c.match(/Edge\/(\d+)/))||uc[1]>=74)&&(uc=$c.match(/Chrome\/(\d+)/))&&(pc=+uc[1]);var Qc=pc,td=ic,ed=tc.String,id=!!Object.getOwnPropertySymbols&&!td((function(){var t=Symbol();return!ed(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Qc&&Qc<41})),nd=id&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,sd=Gc,rd=Hc,ad=Yc,od=Object,ld=nd?function(t){return"symbol"==typeof t}:function(t){var e=sd("Symbol");return rd(e)&&ad(e.prototype,od(t))},hd=String,cd=function(t){try{return hd(t)}catch(t){return"Object"}},dd=Hc,ud=cd,pd=TypeError,gd=function(t){if(dd(t))return t;throw pd(ud(t)+" is not a function")},fd=gd,md=Ec,yd=function(t,e){var i=t[e];return md(i)?void 0:fd(i)},_d=oc,vd=Hc,bd=Vc,xd=TypeError,Sd={exports:{}},wd=tc,Ad=Object.defineProperty,kd=function(t,e){try{Ad(wd,t,{value:e,configurable:!0,writable:!0})}catch(i){wd[t]=e}return e},Md=kd,Cd="__core-js_shared__",Td=tc[Cd]||Md(Cd,{}),Ed=Td;(Sd.exports=function(t,e){return Ed[t]||(Ed[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Pd=Sd.exports,Rd=Bc,Bd=Object,Id=function(t){return Bd(Rd(t))},Dd=Id,Ld=vc({}.hasOwnProperty),Od=Object.hasOwn||function(t,e){return Ld(Dd(t),e)},Fd=vc,zd=0,Hd=Math.random(),jd=Fd(1..toString),Nd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+jd(++zd+Hd,36)},Vd=Pd,Wd=Od,Ud=Nd,Gd=id,Yd=nd,Xd=tc.Symbol,$d=Vd("wks"),Kd=Yd?Xd.for||Xd:Xd&&Xd.withoutSetter||Ud,qd=function(t){return Wd($d,t)||($d[t]=Gd&&Wd(Xd,t)?Xd[t]:Kd("Symbol."+t)),$d[t]},Zd=oc,Jd=Vc,Qd=ld,tu=yd,eu=function(t,e){var i,n;if("string"===e&&vd(i=t.toString)&&!bd(n=_d(i,t)))return n;if(vd(i=t.valueOf)&&!bd(n=_d(i,t)))return n;if("string"!==e&&vd(i=t.toString)&&!bd(n=_d(i,t)))return n;throw xd("Can't convert object to primitive value")},iu=TypeError,nu=qd("toPrimitive"),su=function(t,e){if(!Jd(t)||Qd(t))return t;var i,n=tu(t,nu);if(n){if(void 0===e&&(e="default"),i=Zd(n,t,e),!Jd(i)||Qd(i))return i;throw iu("Can't convert object to primitive value")}return void 0===e&&(e="number"),eu(t,e)},ru=ld,au=function(t){var e=su(t,"string");return ru(e)?e:e+""},ou=Vc,lu=tc.document,hu=ou(lu)&&ou(lu.createElement),cu=function(t){return hu?lu.createElement(t):{}},du=cu,uu=!nc&&!ic((function(){return 7!=Object.defineProperty(du("div"),"a",{get:function(){return 7}}).a})),pu=nc,gu=oc,fu=lc,mu=gc,yu=Lc,_u=au,vu=Od,bu=uu,xu=Object.getOwnPropertyDescriptor;ec.f=pu?xu:function(t,e){if(t=yu(t),e=_u(e),bu)try{return xu(t,e)}catch(t){}if(vu(t,e))return mu(!gu(fu.f,t,e),t[e])};var Su={},wu=nc&&ic((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Au=Vc,ku=String,Mu=TypeError,Cu=function(t){if(Au(t))return t;throw Mu(ku(t)+" is not an object")},Tu=nc,Eu=uu,Pu=wu,Ru=Cu,Bu=au,Iu=TypeError,Du=Object.defineProperty,Lu=Object.getOwnPropertyDescriptor,Ou="enumerable",Fu="configurable",zu="writable";Su.f=Tu?Pu?function(t,e,i){if(Ru(t),e=Bu(e),Ru(i),"function"==typeof t&&"prototype"===e&&"value"in i&&zu in i&&!i[zu]){var n=Lu(t,e);n&&n[zu]&&(t[e]=i.value,i={configurable:Fu in i?i[Fu]:n[Fu],enumerable:Ou in i?i[Ou]:n[Ou],writable:!1})}return Du(t,e,i)}:Du:function(t,e,i){if(Ru(t),e=Bu(e),Ru(i),Eu)try{return Du(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Iu("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var Hu=Su,ju=gc,Nu=nc?function(t,e,i){return Hu.f(t,e,ju(1,i))}:function(t,e,i){return t[e]=i,t},Vu={exports:{}},Wu=nc,Uu=Od,Gu=Function.prototype,Yu=Wu&&Object.getOwnPropertyDescriptor,Xu=Uu(Gu,"name"),$u={EXISTS:Xu,PROPER:Xu&&"something"===function(){}.name,CONFIGURABLE:Xu&&(!Wu||Wu&&Yu(Gu,"name").configurable)},Ku=Hc,qu=Td,Zu=vc(Function.toString);Ku(qu.inspectSource)||(qu.inspectSource=function(t){return Zu(t)});var Ju,Qu,tp,ep=qu.inspectSource,ip=Hc,np=tc.WeakMap,sp=ip(np)&&/native code/.test(String(np)),rp=Nd,ap=Pd("keys"),op=function(t){return ap[t]||(ap[t]=rp(t))},lp={},hp=sp,cp=tc,dp=Vc,up=Nu,pp=Od,gp=Td,fp=op,mp=lp,yp="Object already initialized",_p=cp.TypeError,vp=cp.WeakMap;if(hp||gp.state){var bp=gp.state||(gp.state=new vp);bp.get=bp.get,bp.has=bp.has,bp.set=bp.set,Ju=function(t,e){if(bp.has(t))throw _p(yp);return e.facade=t,bp.set(t,e),e},Qu=function(t){return bp.get(t)||{}},tp=function(t){return bp.has(t)}}else{var xp=fp("state");mp[xp]=!0,Ju=function(t,e){if(pp(t,xp))throw _p(yp);return e.facade=t,up(t,xp,e),e},Qu=function(t){return pp(t,xp)?t[xp]:{}},tp=function(t){return pp(t,xp)}}var Sp={set:Ju,get:Qu,has:tp,enforce:function(t){return tp(t)?Qu(t):Ju(t,{})},getterFor:function(t){return function(e){var i;if(!dp(e)||(i=Qu(e)).type!==t)throw _p("Incompatible receiver, "+t+" required");return i}}},wp=vc,Ap=ic,kp=Hc,Mp=Od,Cp=nc,Tp=$u.CONFIGURABLE,Ep=ep,Pp=Sp.enforce,Rp=Sp.get,Bp=String,Ip=Object.defineProperty,Dp=wp("".slice),Lp=wp("".replace),Op=wp([].join),Fp=Cp&&!Ap((function(){return 8!==Ip((function(){}),"length",{value:8}).length})),zp=String(String).split("String"),Hp=Vu.exports=function(t,e,i){"Symbol("===Dp(Bp(e),0,7)&&(e="["+Lp(Bp(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Mp(t,"name")||Tp&&t.name!==e)&&(Cp?Ip(t,"name",{value:e,configurable:!0}):t.name=e),Fp&&i&&Mp(i,"arity")&&t.length!==i.arity&&Ip(t,"length",{value:i.arity});try{i&&Mp(i,"constructor")&&i.constructor?Cp&&Ip(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Pp(t);return Mp(n,"source")||(n.source=Op(zp,"string"==typeof e?e:"")),t};Function.prototype.toString=Hp((function(){return kp(this)&&Rp(this).source||Ep(this)}),"toString");var jp=Vu.exports,Np=Hc,Vp=Su,Wp=jp,Up=kd,Gp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Np(i)&&Wp(i,r,n),n.global)s?t[e]=i:Up(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Vp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Yp={},Xp=Math.ceil,$p=Math.floor,Kp=Math.trunc||function(t){var e=+t;return(e>0?$p:Xp)(e)},qp=function(t){var e=+t;return e!=e||0===e?0:Kp(e)},Zp=qp,Jp=Math.max,Qp=Math.min,tg=function(t,e){var i=Zp(t);return i<0?Jp(i+e,0):Qp(i,e)},eg=qp,ig=Math.min,ng=function(t){return t>0?ig(eg(t),9007199254740991):0},sg=function(t){return ng(t.length)},rg=Lc,ag=tg,og=sg,lg=function(t){return function(e,i,n){var s,r=rg(e),a=og(r),o=ag(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},hg={includes:lg(!0),indexOf:lg(!1)},cg=Od,dg=Lc,ug=hg.indexOf,pg=lp,gg=vc([].push),fg=function(t,e){var i,n=dg(t),s=0,r=[];for(i in n)!cg(pg,i)&&cg(n,i)&&gg(r,i);for(;e.length>s;)cg(n,i=e[s++])&&(~ug(r,i)||gg(r,i));return r},mg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yg=fg,_g=mg.concat("length","prototype");Yp.f=Object.getOwnPropertyNames||function(t){return yg(t,_g)};var vg={};vg.f=Object.getOwnPropertySymbols;var bg=Gc,xg=Yp,Sg=vg,wg=Cu,Ag=vc([].concat),kg=bg("Reflect","ownKeys")||function(t){var e=xg.f(wg(t)),i=Sg.f;return i?Ag(e,i(t)):e},Mg=Od,Cg=kg,Tg=ec,Eg=Su,Pg=ic,Rg=Hc,Bg=/#|\.prototype\./,Ig=function(t,e){var i=Lg[Dg(t)];return i==Fg||i!=Og&&(Rg(e)?Pg(e):!!e)},Dg=Ig.normalize=function(t){return String(t).replace(Bg,".").toLowerCase()},Lg=Ig.data={},Og=Ig.NATIVE="N",Fg=Ig.POLYFILL="P",zg=Ig,Hg=tc,jg=ec.f,Ng=Nu,Vg=Gp,Wg=kd,Ug=function(t,e,i){for(var n=Cg(e),s=Eg.f,r=Tg.f,a=0;ar;r++)if((o=y(t[r]))&&vm(km,o))return o;return new Am(!1)}n=bm(t,s)}for(l=u?t.next:n.next;!(h=gm(l,n)).done;){try{o=y(h.value)}catch(t){Sm(n,"throw",t)}if("object"==typeof o&&o&&vm(km,o))return o}return new Am(!1)},Cm=Yc,Tm=TypeError,Em=function(t,e){if(Cm(e,t))return t;throw Tm("Incorrect invocation")},Pm=qd("iterator"),Rm=!1;try{var Bm=0,Im={next:function(){return{done:!!Bm++}},return:function(){Rm=!0}};Im[Pm]=function(){return this},Array.from(Im,(function(){throw 2}))}catch(rl){}var Dm=Su.f,Lm=Od,Om=qd("toStringTag"),Fm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Lm(t,Om)&&Dm(t,Om,{configurable:!0,value:e})},zm=vc,Hm=gd,jm=Hc,Nm=String,Vm=TypeError,Wm=function(t,e,i){try{return zm(Hm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Um=Cu,Gm=function(t){if("object"==typeof t||jm(t))return t;throw Vm("Can't set "+Nm(t)+" as a prototype")},Ym=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Wm(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Um(i),Gm(n),e?t(i,n):i.__proto__=n,i}}():void 0),Xm=Hc,$m=Vc,Km=Ym,qm=Yg,Zm=tc,Jm=vc,Qm=zg,ty=Gp,ey=Bf,iy=Mm,ny=Em,sy=Hc,ry=Ec,ay=Vc,oy=ic,ly=function(t,e){if(!e&&!Rm)return!1;var i=!1;try{var n={};n[Pm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},hy=Fm,cy=function(t,e,i){var n,s;return Km&&Xm(n=e.constructor)&&n!==i&&$m(s=n.prototype)&&s!==i.prototype&&Km(t,s),t},dy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=Zm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=Jm(o[t]);ty(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!ay(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!ay(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!ay(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Qm(t,!sy(a)||!(s||o.forEach&&!oy((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),ey.enable();else if(Qm(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=oy((function(){d.has(1)})),g=ly((function(t){new a(t)})),f=!s&&oy((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){ny(t,o);var i=cy(new a,t,l);return ry(e)||iy(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,qm({global:!0,constructor:!0,forced:l!=a},h),hy(l,t),s||i.setStrong(l,t,n),l},uy={},py=fg,gy=mg,fy=Object.keys||function(t){return py(t,gy)},my=nc,yy=wu,_y=Su,vy=Cu,by=Lc,xy=fy;uy.f=my&&!yy?Object.defineProperties:function(t,e){vy(t);for(var i,n=by(e),s=xy(e),r=s.length,a=0;r>a;)_y.f(t,i=s[a++],n[i]);return t};var Sy,wy=Gc("document","documentElement"),Ay=Cu,ky=uy,My=mg,Cy=lp,Ty=wy,Ey=cu,Py="prototype",Ry="script",By=op("IE_PROTO"),Iy=function(){},Dy=function(t){return"<"+Ry+">"+t+""},Ly=function(t){t.write(Dy("")),t.close();var e=t.parentWindow.Object;return t=null,e},Oy=function(){try{Sy=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Oy="undefined"!=typeof document?document.domain&&Sy?Ly(Sy):(e=Ey("iframe"),i="java"+Ry+":",e.style.display="none",Ty.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Dy("document.F=Object")),t.close(),t.F):Ly(Sy);for(var n=My.length;n--;)delete Oy[Py][My[n]];return Oy()};Cy[By]=!0;var Fy,zy,Hy,jy=Object.create||function(t,e){var i;return null!==t?(Iy[Py]=Ay(t),i=new Iy,Iy[Py]=null,i[By]=t):i=Oy(),void 0===e?i:ky.f(i,e)},Ny=jp,Vy=Su,Wy=function(t,e,i){return i.get&&Ny(i.get,e,{getter:!0}),i.set&&Ny(i.set,e,{setter:!0}),Vy.f(t,e,i)},Uy=Gp,Gy=function(t,e,i){for(var n in e)Uy(t,n,e[n],i);return t},Yy=!ic((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Xy=Od,$y=Hc,Ky=Id,qy=Yy,Zy=op("IE_PROTO"),Jy=Object,Qy=Jy.prototype,t_=qy?Jy.getPrototypeOf:function(t){var e=Ky(t);if(Xy(e,Zy))return e[Zy];var i=e.constructor;return $y(i)&&e instanceof i?i.prototype:e instanceof Jy?Qy:null},e_=ic,i_=Hc,n_=Vc,s_=t_,r_=Gp,a_=qd("iterator"),o_=!1;[].keys&&("next"in(Hy=[].keys())?(zy=s_(s_(Hy)))!==Object.prototype&&(Fy=zy):o_=!0);var l_=!n_(Fy)||e_((function(){var t={};return Fy[a_].call(t)!==t}));l_&&(Fy={}),i_(Fy[a_])||r_(Fy,a_,(function(){return this}));var h_={IteratorPrototype:Fy,BUGGY_SAFARI_ITERATORS:o_},c_=h_.IteratorPrototype,d_=jy,u_=gc,p_=Fm,g_=jf,f_=function(){return this},m_=Yg,y_=oc,__=Hc,v_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=d_(c_,{next:u_(+!n,i)}),p_(t,s,!1),g_[s]=f_,t},b_=t_,x_=Ym,S_=Fm,w_=Nu,A_=Gp,k_=jf,M_=$u.PROPER,C_=$u.CONFIGURABLE,T_=h_.IteratorPrototype,E_=h_.BUGGY_SAFARI_ITERATORS,P_=qd("iterator"),R_="keys",B_="values",I_="entries",D_=function(){return this},L_=Gc,O_=Wy,F_=nc,z_=qd("species"),H_=jy,j_=Wy,N_=Gy,V_=Hf,W_=Em,U_=Ec,G_=Mm,Y_=function(t,e,i,n,s,r,a){v_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!E_&&t in p)return p[t];switch(t){case R_:case B_:case I_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[P_]||p["@@iterator"]||s&&p[s],f=!E_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=b_(m.call(new t)))!==Object.prototype&&o.next&&(b_(o)!==T_&&(x_?x_(o,T_):__(o[P_])||A_(o,P_,D_)),S_(o,d,!0)),M_&&s==B_&&g&&g.name!==B_&&(C_?w_(p,"name",B_):(u=!0,f=function(){return y_(g,this)})),s)if(l={values:c(B_),keys:r?f:c(R_),entries:c(I_)},a)for(h in l)(E_||u||!(h in p))&&A_(p,h,l[h]);else m_({target:e,proto:!0,forced:E_||u},l);return p[P_]!==f&&A_(p,P_,f,{name:s}),k_[e]=f,l},X_=function(t,e){return{value:t,done:e}},$_=function(t){var e=L_(t);F_&&e&&!e[z_]&&O_(e,z_,{configurable:!0,get:function(){return this}})},K_=nc,q_=Bf.fastKey,Z_=Sp.set,J_=Sp.getterFor,Q_={getConstructor:function(t,e,i,n){var s=t((function(t,s){W_(t,r),Z_(t,{type:e,index:H_(null),first:void 0,last:void 0,size:0}),K_||(t.size=0),U_(s)||G_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=J_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=q_(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),K_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=q_(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return N_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,K_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),K_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=V_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),N_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),K_&&j_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=J_(e),r=J_(n);Y_(t,e,(function(t,e){Z_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?X_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,X_(void 0,!0))}),i?"entries":"values",!i,!0),$_(e)}};dy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Q_);var tv=wc,ev=Array.isArray||function(t){return"Array"==tv(t)},iv=vc,nv=ic,sv=Hc,rv=Zf,av=ep,ov=function(){},lv=[],hv=Gc("Reflect","construct"),cv=/^\s*(?:class|function)\b/,dv=iv(cv.exec),uv=!cv.exec(ov),pv=function(t){if(!sv(t))return!1;try{return hv(ov,lv,t),!0}catch(t){return!1}},gv=function(t){if(!sv(t))return!1;switch(rv(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return uv||!!dv(cv,av(t))}catch(t){return!0}};gv.sham=!0;var fv=!hv||nv((function(){var t;return pv(pv.call)||!pv(Object)||!pv((function(){t=!0}))||t}))?gv:pv,mv=ev,yv=fv,_v=Vc,vv=qd("species"),bv=Array,xv=function(t){var e;return mv(t)&&(e=t.constructor,(yv(e)&&(e===bv||mv(e.prototype))||_v(e)&&null===(e=e[vv]))&&(e=void 0)),void 0===e?bv:e},Sv=Hf,wv=Tc,Av=Id,kv=sg,Mv=function(t,e){return new(xv(t))(0===e?0:e)},Cv=vc([].push),Tv=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=Av(l),f=wv(g),m=Sv(h,c),y=kv(f),_=0,v=d||Mv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Cv(b,u)}else switch(t){case 4:return!1;case 7:Cv(b,u)}return r?-1:n||s?s:b}},Ev={forEach:Tv(0),map:Tv(1),filter:Tv(2),some:Tv(3),every:Tv(4),find:Tv(5),findIndex:Tv(6),filterReject:Tv(7)},Pv=vc,Rv=Gy,Bv=Bf.getWeakData,Iv=Em,Dv=Cu,Lv=Ec,Ov=Vc,Fv=Mm,zv=Od,Hv=Sp.set,jv=Sp.getterFor,Nv=Ev.find,Vv=Ev.findIndex,Wv=Pv([].splice),Uv=0,Gv=function(t){return t.frozen||(t.frozen=new Yv)},Yv=function(){this.entries=[]},Xv=function(t,e){return Nv(t.entries,(function(t){return t[0]===e}))};Yv.prototype={get:function(t){var e=Xv(this,t);if(e)return e[1]},has:function(t){return!!Xv(this,t)},set:function(t,e){var i=Xv(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Vv(this.entries,(function(e){return e[0]===t}));return~e&&Wv(this.entries,e,1),!!~e}};var $v,Kv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Iv(t,r),Hv(t,{type:e,id:Uv++,frozen:void 0}),Lv(s)||Fv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=jv(e),o=function(t,e,i){var n=a(t),s=Bv(Dv(e),!0);return!0===s?Gv(n).set(e,i):s[n.id]=i,t};return Rv(r,{delete:function(t){var e=a(this);if(!Ov(t))return!1;var i=Bv(t);return!0===i?Gv(e).delete(t):i&&zv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!Ov(t))return!1;var i=Bv(t);return!0===i?Gv(e).has(t):i&&zv(i,e.id)}}),Rv(r,i?{get:function(t){var e=a(this);if(Ov(t)){var i=Bv(t);return!0===i?Gv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},qv=mf,Zv=tc,Jv=vc,Qv=Gy,tb=Bf,eb=dy,ib=Kv,nb=Vc,sb=Sp.enforce,rb=ic,ab=sp,ob=Object,lb=Array.isArray,hb=ob.isExtensible,cb=ob.isFrozen,db=ob.isSealed,ub=ob.freeze,pb=ob.seal,gb={},fb={},mb=!Zv.ActiveXObject&&"ActiveXObject"in Zv,yb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},_b=eb("WeakMap",yb,ib),vb=_b.prototype,bb=Jv(vb.set);if(ab)if(mb){$v=ib.getConstructor(yb,"WeakMap",!0),tb.enable();var xb=Jv(vb.delete),Sb=Jv(vb.has),wb=Jv(vb.get);Qv(vb,{delete:function(t){if(nb(t)&&!hb(t)){var e=sb(this);return e.frozen||(e.frozen=new $v),xb(this,t)||e.frozen.delete(t)}return xb(this,t)},has:function(t){if(nb(t)&&!hb(t)){var e=sb(this);return e.frozen||(e.frozen=new $v),Sb(this,t)||e.frozen.has(t)}return Sb(this,t)},get:function(t){if(nb(t)&&!hb(t)){var e=sb(this);return e.frozen||(e.frozen=new $v),Sb(this,t)?wb(this,t):e.frozen.get(t)}return wb(this,t)},set:function(t,e){if(nb(t)&&!hb(t)){var i=sb(this);i.frozen||(i.frozen=new $v),Sb(this,t)?bb(this,t,e):i.frozen.set(t,e)}else bb(this,t,e);return this}})}else qv&&rb((function(){var t=ub([]);return bb(new _b,t,1),!cb(t)}))&&Qv(vb,{set:function(t,e){var i;return lb(t)&&(cb(t)?i=gb:db(t)&&(i=fb)),bb(this,t,e),i==gb&&ub(t),i==fb&&pb(t),this}});var Ab=Gc,kb=vc,Mb=Pd,Cb=Ab("Map"),Tb=Ab("WeakMap"),Eb=kb([].push),Pb=Mb("metadata"),Rb=Pb.store||(Pb.store=new Tb),Bb=function(t,e,i){var n=Rb.get(t);if(!n){if(!i)return;Rb.set(t,n=new Cb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Cb)}return s},Ib={store:Rb,getMap:Bb,has:function(t,e,i){var n=Bb(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Bb(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Bb(i,n,!0).set(t,e)},keys:function(t,e){var i=Bb(t,e,!1),n=[];return i&&i.forEach((function(t,e){Eb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Db=Cu,Lb=Ib.toKey,Ob=Ib.set;Yg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Lb(arguments[3]);Ob(t,e,Db(i),n)}});var Fb=Cu,zb=Ib.toKey,Hb=Ib.getMap,jb=Ib.store;Yg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:zb(arguments[2]),n=Hb(Fb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=jb.get(e);return s.delete(i),!!s.size||jb.delete(e)}});var Nb=Cu,Vb=t_,Wb=Ib.has,Ub=Ib.get,Gb=Ib.toKey,Yb=function(t,e,i){if(Wb(t,e,i))return Ub(t,e,i);var n=Vb(e);return null!==n?Yb(t,n,i):void 0};Yg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Gb(arguments[2]);return Yb(t,Nb(e),i)}});var Xb=vc,$b=Map.prototype,Kb={Map:Map,set:Xb($b.set),get:Xb($b.get),has:Xb($b.has),remove:Xb($b.delete),proto:$b},qb=oc,Zb=vc,Jb=function(t,e,i){for(var n,s,r=i||t.next;!(n=qb(r,t)).done;)if(void 0!==(s=e(n.value)))return s},Qb=Kb.Map,tx=Kb.proto,ex=Zb(tx.forEach),ix=Zb(tx.entries),nx=ix(new Qb).next,sx=gd,rx=Ec,ax=sg,ox=Id,lx=function(t,e,i){return i?Jb(ix(t),(function(t){return e(t[1],t[0])}),nx):ex(t,e)},hx=Kb.Map,cx=Kb.has,dx=Kb.set,ux=vc([].push),px=Yg,gx=vc,fx=Ib,mx=Cu,yx=t_,_x=function(t){var e,i,n,s=ox(this),r=ax(s),a=[],o=new hx,l=rx(t)?function(t){return t}:sx(t);for(e=0;e= than the number of constructor arguments of its base class."},mS=function(t,e){return"@postConstruct error in class "+t+": "+e},yS=function(t,e){return"@preDestroy error in class "+t+": "+e},_S=function(t,e){return"onDeactivation() error in class "+t+": "+e},vS="Maximum call stack size exceeded",bS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(qx,t),userGeneratedMetadata:Reflect.getMetadata($x,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(Kx,t)||[]},t}(),xS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function SS(t){return t instanceof RangeError||t.message===vS}function wS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function AS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=CS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function kS(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||kS(t.parentRequest,e))}function MS(t){t.childRequests.forEach((function(t){if(kS(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=wS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(pS+" "+e)}MS(t)}))}function CS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var TS=function(){function t(t){this.id=sS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),ES=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Vx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),PS=function(t,e){this.parentContext=t,this.rootRequest=e},RS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),BS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),IS=function(){function t(t,e,i,n){this.id=sS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new BS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new ES(Vx,n):n instanceof ES&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:HS(t,i)}return 0}function jS(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Yx],multiInject:e[Xx],targetName:e[Wx],unmanaged:e[Ux]}}var NS=function(){function t(t,e,i,n,s){this.id=sS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function VS(t){return t._bindingDictionary}function WS(t,e,i,n,s){var r=GS(i.container,s.serviceIdentifier),a=[];return r.length===xS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=GS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new NS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case xS.NoBindingsAvailable:if(i.isOptional())return e;var s=wS(t),r=cS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=AS(n,s,GS),new Error(r);case xS.OnlyOneBindingAvailable:return e;case xS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=wS(t),r=hS+" "+s;throw r+=AS(n,s,GS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function US(t,e,i,n,s,r){var a,o;if(null===s){a=WS(t,e,n,null,r),o=new NS(i,n,null,a,r);var l=new PS(n,o);n.addPlan(l)}else a=WS(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===eS.Instance&&null!==e.implementationType){var s=function(t,e){return LS(t,CS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=HS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===iS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=$S(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=ew(ew({},s),{constr:t});n=s.isAsync?function(t){return iw(this,void 0,void 0,(function(){var e,i;return nw(this,(function(n){switch(n.label){case 0:return[4,ow(t.constructorInjections)];case 1:return e=n.sent(),[4,ow(t.propertyInjections)];case 2:return i=n.sent(),[2,aw(ew(ew({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):aw(r)}else n=new t;return n}function aw(t){var e,i=new((e=t.constr).bind.apply(e,sw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function ow(t){return iw(this,void 0,void 0,(function(){var e,i,n,s;return nw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Lw=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Dw,onDeactivations:new Dw}},t}(),Ow=function(){return Ow=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new eA(e,i)})).inSingletonScope().whenTargetNamed(e)}class nA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class sA extends nA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const rA=Symbol.for("EnvContribution"),aA=Symbol.for("Global");var oA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hA=function(t,e){return function(i,n){e(i,n,t)}};let cA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new sA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};cA=oA([Yw(),hA(0,Kw(tA)),hA(0,Xw(rA)),lA("design:paramtypes",[Object])],cA);const dA=kt-1e-8;class uA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>dA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=kt)<0&&(n+=kt),(s%=kt)<0&&(s+=kt),ss;++o,a-=At)g(a);else for(a=n-n%At+At,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const gA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,fA={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},mA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let yA,_A,vA,bA,xA,SA;var wA,AA,kA,MA,CA,TA,EA,PA,RA;function BA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function IA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Ut(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=kt:T>0&&0===r&&(T-=kt);const E=Math.ceil(Math.abs(T/(At+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function OA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class YA extends GA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function XA(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class $A{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function KA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new GA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new $A(s,n),t),s}function qA(t,e,i,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n)}class ZA{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&qA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:qA(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function JA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return KA(t,e);const s=new GA("basis",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new ZA(s,n),t),s}function QA(t){return t<0?-1:1}function tk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(QA(r)+QA(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function ek(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function ik(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class nk{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined2);break;case 3:ik(this,this._t0,ek(this,this._t0),!1!==this._lastDefined2)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,ik(this,ek(this,e=tk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:ik(this,this._t0,e=tk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined}}tryUpdateLength(){return this.context.tryUpdateLength()}}class sk extends nk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function rk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return KA(t,e);const s=new GA("monotoneX",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new nk(s,n),t),s}function ak(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return KA(t,e);const s=new YA("monotoneY",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new sk(s,n),t),s}let ok=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function lk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new GA("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new ok(r,e,s),t),r}class hk{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){this.context.closePath()}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ck(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new GA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new hk(s,n),t),s}function dk(t,e,i){switch(e){case"linear":default:return KA(t,i);case"basis":return JA(t,i);case"monotoneX":return rk(t,i);case"monotoneY":return ak(t,i);case"step":return lk(t,.5,i);case"stepBefore":return lk(t,0,i);case"stepAfter":return lk(t,1,i);case"linearClosed":return ck(t,i)}}class uk extends pA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new uA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([mA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([mA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([mA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([mA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([mA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([mA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([mA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([mA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([mA.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const t=[];t[mA.M]=t=>`M${t[1]} ${t[2]}`,t[mA.L]=t=>`L${t[1]} ${t[2]}`,t[mA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[mA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[mA.A]=t=>{const e=[];DA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tSA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),OA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===EA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ct(t.p0.y-e.p1.y)}if(this.direction===EA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ct(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const pk=["l",0,0,0,0,0,0,0];function gk(t,e,i){const n=pk[0]=t[0];if("a"===n||"A"===n)pk[1]=e*t[1],pk[2]=i*t[2],pk[3]=t[3],pk[4]=t[4],pk[5]=t[5],pk[6]=e*t[6],pk[7]=i*t[7];else if("h"===n||"H"===n)pk[1]=e*t[1];else if("v"===n||"V"===n)pk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Ek=Object.assign(Object.assign({},xk),{points:[],cornerRadius:0}),Pk=Object.assign(Object.assign({},xk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Rk=Object.assign(Object.assign({},xk),{width:0,height:0,cornerRadius:0,length:0}),Bk=Object.assign(Object.assign({},xk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Ik=Object.assign(Object.assign(Object.assign({},xk),vk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dk=Object.assign(Object.assign({},xk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Lk=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},xk),{fill:!0}),Ok=Object.assign(Object.assign({},Lk),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});var Fk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Ik.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};zk=Fk([Yw()],zk);var Hk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const jk=Symbol.for("TextMeasureContribution");let Nk=class extends zk{};Nk=Hk([Yw()],Nk);const Vk=new jw;const Wk=new class{},Uk=Symbol.for("CanvasFactory"),Gk=Symbol.for("Context2dFactory");function Yk(t){return Vk.getNamed(Uk,Wk.global.env)(t)}const Xk=1e-4,$k=Math.sqrt(3),Kk=1/3;function qk(t){return t>-cM&&tcM||t<-cM}const Jk=[0,0],Qk=[0,0],tM=[0,0];function eM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function iM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function nM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function sM(t){return(t%=Mt)<0&&(t+=Mt),t}function rM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function aM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Mt);let d=Math.atan2(l,o);return d<0&&(d+=Mt),d>=n&&d<=s||d+Mt>=n&&d+Mt<=s}function hM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(qk(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const uM=[-1,-1,-1],pM=[-1,-1];function gM(){const t=pM[0];pM[0]=pM[1],pM[1]=t}function fM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(qk(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Kk):Math.pow(i,Kk),n=n<0?-Math.pow(-n,Kk):Math.pow(n,Kk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+$k*Math.sin(e)))/(3*a),h=(-o+i*(n-$k*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,uM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&gM(),p=nM(e,n,r,o,pM[0]),u>1&&(g=nM(e,n,r,o,pM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(qk(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,uM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=iM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);uM[0]=-l,uM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Mt-1e-4){n=0,s=Mt;const e=r?1:-1;return a>=uM[0]+t&&a<=uM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Mt,s+=Mt);let c=0;for(let e=0;e<2;e++){const i=uM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=s||t+Mt>=n&&t+Mt<=s)&&(t>wt/2&&t<1.5*wt&&(e=-e),c+=e)}}return c}function _M(t){return Math.round(t/wt*1e8)/1e8%2*wt}function vM(t,e){let i=_M(t[0]);i<0&&(i+=Mt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Mt?s=i+Mt:e&&i-s>=Mt?s=i-Mt:!e&&i>s?s=i+(Mt-_M(i-s)):e&&i1&&(i||(h+=rM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;bM[0]=S,bM[1]=w,vM(bM,Boolean(a[6])),S=bM[0],w=bM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case mA.M:u=m,p=y,c=u,d=p;break;case mA.L:if(i){if(hM(c,d,m,y,e,n,s))return!0}else h+=rM(c,d,m,y,n,s)||0;c=m,d=y;break;case mA.C:if(i){if(oM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=fM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case mA.Q:if(i){if(aM(c,d,m,y,_,v,e,n,s))return!0}else h+=mM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case mA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=rM(c,d,o,l,n,s),i){if(lM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=yM(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case mA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(hM(u,p,o,p,e,n,s)||hM(o,p,o,l,e,n,s)||hM(o,l,u,l,e,n,s)||hM(u,l,u,p,e,n,s))return!0}else h+=rM(o,p,o,l,n,s),h+=rM(u,l,u,p,n,s);break;case mA.Z:if(i){if(hM(c,d,u,p,e,n,s))return!0}else h+=rM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AM=function(t,e){return function(i,n){e(i,n,t)}};let kM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Yk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:vk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ze(Object.assign({defaultFontParams:{fontFamily:vk.fontFamily,fontSize:vk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ze.ALPHABET_CHAR_SET+ze.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var MM;kM=SM([Yw(),AM(0,Kw(tA)),AM(0,Xw(jk)),AM(1,Kw(aA)),wM("design:paramtypes",[Object,Object])],kM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(MM||(MM={}));const CM=new qt;let TM=class{constructor(){this.matrix=new qt}init(t){return this.mode=MM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=MM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(CM.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(CM.a,CM.b,CM.c,CM.d,CM.e,CM.f),this}scale(t,e,i){return this.mode===MM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return CM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(CM.a,CM.b,CM.c,CM.d,CM.e,CM.f),this}translate(t,e){return this.mode===MM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===MM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};TM=SM([Yw(),wM("design:paramtypes",[])],TM);const EM={arc:Sk,area:wk,circle:Ak,line:Ck,path:Tk,symbol:Bk,text:Ik,rect:Pk,rect3d:Rk,polygon:Ek,richtext:Dk,richtextIcon:Ok,image:Lk,group:kk,glyph:Mk},PM=Object.keys(EM);function RM(){return{arc:Object.assign({},EM.arc),area:Object.assign({},EM.area),circle:Object.assign({},EM.circle),line:Object.assign({},EM.line),path:Object.assign({},EM.path),symbol:Object.assign({},EM.symbol),text:Object.assign({},EM.text),rect:Object.assign({},EM.rect),rect3d:Object.assign({},EM.rect3d),polygon:Object.assign({},EM.polygon),richtext:Object.assign({},EM.richtext),richtextIcon:Object.assign({},EM.richtextIcon),image:Object.assign({},EM.image),group:Object.assign({},EM.group),glyph:Object.assign({},EM.glyph)}}function BM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const IM=new Array(60).fill(0).map((()=>RM()));class DM{constructor(){this._defaultTheme=IM.pop()||RM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?BM(this.userTheme,t.userTheme,!1):this.userTheme=P(t.userTheme),BM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);PM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const LM=new DM;function OM(t,e){return t.glyphHost?OM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):LM.getTheme()}return null}(t)||LM.getTheme()}class FM{static GenAutoIncrementId(){return FM.auto_increment_id++}}FM.auto_increment_id=0;var zM=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class HM extends r{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=FM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return zM(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(YM(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=YM(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=YM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=YM(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=GM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(YM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(YM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,YM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):YM(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof WM))return void console.warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i=0&&t<=C(this.rootTarget,"width")&&e>=0&&e<=C(this.rootTarget,"height")?this.rootTarget:null,i}}const $M={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof jM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new UM(t,e))}},KM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class qM{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new XM(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new VM,this.rootWheelEvent=new WM,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&f(t)&&!E(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class ZM{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const JM=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},QM=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class tC extends r{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=GM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=GM.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||JM(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=QM(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=GM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=QM(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=JM(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=GM.now()-i>this.config.press.time&&QM(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class iC{static Avaliable(){return!0}avaliable(){return iC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class nC{static Avaliable(){return!!Wk.global.getRequestAnimationFrame()}avaliable(){return nC.Avaliable()}tick(t,e){Wk.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var sC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(sC||(sC={}));class rC{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-rC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*rC.bounceIn(2*t):.5*rC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}rC.quadIn=rC.getPowIn(2),rC.quadOut=rC.getPowOut(2),rC.quadInOut=rC.getPowInOut(2),rC.cubicIn=rC.getPowIn(3),rC.cubicOut=rC.getPowOut(3),rC.cubicInOut=rC.getPowInOut(3),rC.quartIn=rC.getPowIn(4),rC.quartOut=rC.getPowOut(4),rC.quartInOut=rC.getPowInOut(4),rC.quintIn=rC.getPowIn(5),rC.quintOut=rC.getPowOut(5),rC.quintInOut=rC.getPowInOut(5),rC.backIn=rC.getBackIn(1.7),rC.backOut=rC.getBackOut(1.7),rC.backInOut=rC.getBackInOut(1.7),rC.elasticIn=rC.getElasticIn(1,.3),rC.elasticOut=rC.getElasticOut(1,.3),rC.elasticInOut=rC.getElasticInOut(1,.3*1.5);const aC=new class{constructor(){this.id=FM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===MA.END?this.removeAnimate(e):e.status===MA.RUNNING||e.status===MA.INITIAL?(this.animateCount++,e.advance(t)):e.status===MA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class oC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class lC extends oC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let hC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:FM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aC;this.id=t,this.timeline=e,this.status=MA.INITIAL,this.tailAnimate=new cC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&CA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:kA.ANIMATE_PLAY})}runCb(t){const e=new lC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===MA.RUNNING&&(this.status=MA.PAUSED)}resume(){this.status===MA.PAUSED&&(this.status=MA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new cC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===MA.RUNNING&&(this.status=MA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=MA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};hC.mode=CA.NORMAL,hC.interpolateMap=new Map;class cC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new dC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?rC[i]:i,s=this._addStep(e,null,n);return s.type=TA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?rC[i]:i,r=this._addStep(e,null,s);return r.type=TA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=TA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=TA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new dC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class dC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const uC=200,pC="cubicOut",gC=1e3,fC="quadInOut";var mC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(mC||(mC={}));const yC=[!1,!1,!1,!1],_C=[0,0,0,0],vC=t=>t?m(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(_C[0]=t[0],_C[2]=t[0],_C[1]=t[1],_C[3]=t[1],_C):t:t:0,bC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],xC=[1,2,3,0,1,2,3,0];function SC(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;bC[0].x=i,bC[1].y=i,bC[2].x=-i,bC[3].y=-i;const s=Math.ceil(t/At)%4,r=Math.ceil(e/At)%4;if(n.add(Et(t)*i,Bt(t)*i),n.add(Et(e)*i,Bt(e)*i),s!==r||e-t>wt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ht(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=wC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class PC extends oC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:kA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:kA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:kA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class RC extends PC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=Wk.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class BC extends PC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=Wk.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class IC extends oC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Mt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+wt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z}}class DC extends oC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class LC extends oC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?rC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function OC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function FC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{rt(e,n)&&rt(i,s)||t.push(e,i,n,s,n,s)};function WC(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function UC(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),KC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},qC=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return KC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return KC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);qC(s[0],n,i),qC(s[1],e-n,i)}};var ZC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const JC={};for(const t in ZC)E(ZC,t)&&(JC[ZC[t]]=t);const QC={to:{},get:{}};function tT(t,e,i){return Math.min(Math.max(e,t),i)}function eT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}QC.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=QC.get.hsl(t,n),i="hsl";break;case"hwb":e=QC.get.hwb(t,n),i="hwb";break;default:e=QC.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},QC.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=ZC[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=tT(e[n],0,255);return e[3]=tT(e[3],0,1),e},QC.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=tT(parseFloat(i[2]),0,100),e[2]=tT(parseFloat(i[3]),0,100),e[3]=tT(isNaN(t)?1:t,0,1),e}return null},QC.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=tT(parseFloat(i[2]),0,100),e[2]=tT(parseFloat(i[3]),0,100),e[3]=tT(isNaN(t)?1:t,0,1),e}return null},QC.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},QC.to.keyword=function(t){return JC[t.slice(0,3)]};const iT=QC;var nT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(nT||(nT={}));class sT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===nT.Color1){let e=sT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=QC.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];sT.store1[t]=s,sT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=sT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=QC.get(t),n&&n.value){const e=n.value;sT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],sT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===nT.Color1){if(sT.store1[t])return;sT.store1[t]=i,sT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(sT.store255[t])return;sT.store255[t]=i,sT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function rT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function aT(t,e,i,n,s){if(!t||!e)return t&&rT(t)||e&&rT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=sT.Get(t,nT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=sT.Get(e,nT.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:rT(a)})))});return o?aT(r,l,i,n,s):aT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:hT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:hT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:hT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),rT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}sT.store255={},sT.store1={};const oT=[0,0,0,0],lT=[0,0,0,0];function hT(t,e,i){return sT.Get(t,nT.Color255,oT),sT.Get(e,nT.Color255,lT),`rgba(${Math.round(oT[0]+(lT[0]-oT[0])*i)},${Math.round(oT[1]+(lT[1]-oT[1])*i)},${Math.round(oT[2]+(lT[2]-oT[2])*i)},${oT[3]+(lT[3]-oT[3])*i})`}const cT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=aT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},dT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?WC(t):[],s=WC(e);i&&n&&(i.fromTransform&&UC(n,i.fromTransform.clone().getInverse()),UC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},pT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],gT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!pT.includes(s))return;const r=e[s];h(r)||h(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?sT.Get(t[s],nT.Color255):t[s],to:"string"==typeof r?sT.Get(r,nT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class fT extends oC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;dT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&cT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const mT=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=uT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=gT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new fT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:gC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:fC)),c};class yT extends oC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;dT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&cT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const _T=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>kC.includes(t))(i)||(e[i]=t[i])})),e},vT=(t,e,i)=>{const n=_T(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Wk.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},bT=(t,e,i)=>{const n=[],s=i?null:_T(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:_T(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=YC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Wk.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=YC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Wk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=YC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Wk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return XC(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return XC(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Wk.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:$C(i)}];const n=[];return qC(i,e,n),n})(t,e).forEach((t=>{n.push(Wk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return qC(r,e,h),h})(t,e).forEach((t=>{n.push(Wk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=WC(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Wk.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Wk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&vT(t,n,e),n};class ST{static GetImage(t,e){var i;let n=ST.cache.get(t);n?"fail"===n.loadState?Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},ST.cache.set(t,n),n.dataPromise=Wk.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=ST.cache.get(t);n?"fail"===n.loadState?Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},ST.cache.set(t,n),n.dataPromise=Wk.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=ST.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},ST.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Wk.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Wk.global.loadBlob(t):"json"===e&&(i.dataPromise=Wk.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}ST.cache=new Map;const wT=new qt,AT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],kT=["x","y"],MT=["scaleX","scaleY"],CT=["angle"],TT=new Ht;class ET extends HM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Wt,this._updateTag=wA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=OM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;TT.x=i+e,TT.y=n+s}else TT.x=i,TT.y=n;return TT}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Wk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Wk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new qt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&wA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&wA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&wA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&wA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&wA.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&wA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=wA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===AA.GLOBAL){const i=new Ht(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Wk.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!h(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:uC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:pC)}else this.setAttributes(t,!1,{type:kA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();E(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=wA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=wA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=wA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&wA.UPDATE_SHAPE_AND_BOUNDS)===wA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=wA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=wA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=wA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=wA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=wA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=fk.x,y:e=fk.y,scaleX:i=fk.scaleX,scaleY:n=fk.scaleY,angle:s=fk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Et(a),f=Bt(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(fk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=wT.setValue(a.a,a.b,a.c,a.d,a.e,a.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Wk.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:kA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:kA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=aT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=aT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=aT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return OM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Wk.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return f(t,!0)?this.pathProxy=(new uk).fromString(t):this.pathProxy=new uk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",x(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(ST.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new UM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}ET.mixin($M);var PT=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function RT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let BT=0;function IT(){return BT++}const DT=IT(),LT=IT(),OT=IT(),FT=IT(),zT=IT(),HT=IT(),jT=IT(),NT=IT(),VT=IT(),WT=IT(),UT=IT(),GT=IT(),YT=IT(),XT=IT(),$T=IT(),KT=IT(),qT=Symbol.for("GraphicService"),ZT=Symbol.for("GraphicCreator");var JT;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(JT||(JT={}));let QT=class t extends ET{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=HT,this._childUpdateTag=wA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new DM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new DM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===AA.GLOBAL){const i=new Ht(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&wA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Wk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Wk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=OM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Wk.graphicService.updateGroupAABBBounds(t,OM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=vC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=wA.CLEAR_BOUNDS,this._childUpdateTag&=wA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=wA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&wA.UPDATE_BOUNDS||(this._childUpdateTag|=wA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Wk.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Wk.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Wk.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Wk.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Wk.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&wA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=Wk.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const tE=Symbol.for("LayerHandlerContribution");class eE extends QT{get offscreen(){return this.layerHandler.offscreen}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=Vk.get(tE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new DM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Wk.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Wk.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var iE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sE=function(t,e){return function(i,n){e(i,n,t)}};let rE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new eE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}};rE=iE([Yw(),sE(0,Kw(aA)),nE("design:paramtypes",[Object])],rE);var aE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lE=function(t,e){return function(i,n){e(i,n,t)}};const hE=Symbol.for("Window"),cE=Symbol.for("WindowHandlerContribution");let dE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new sA(["x","y","width","height"])},this._uid=FM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Vk.getNamed(cE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};aE([Qw(),oE("design:type",Function),oE("design:paramtypes",[]),oE("design:returntype",void 0)],dE.prototype,"postInit",null),dE=aE([Yw(),lE(0,Kw(aA)),oE("design:paramtypes",[Object])],dE);const uE=Symbol.for("TransformUtil"),pE=Symbol.for("GraphicUtil"),gE=Symbol.for("LayerService");var fE=new Nw((t=>{t(cA).toSelf().inSingletonScope(),t(aA).toService(cA),t(dE).to(dE),t(hE).toService(dE),t(kM).toSelf().inSingletonScope(),t(pE).toService(kM),t(TM).toSelf().inSingletonScope(),t(uE).toService(TM),t(rE).toSelf().inSingletonScope(),t(gE).toService(rE)}));function mE(t){return!!t}function yE(t,e){let i;return i=m(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function _E(t,e){return t*e>0}function vE(t,e,i,n){return t*e>0&&i>0&&n>0}function bE(t,e){return t*e>0}function xE(t,e,i,n){return t*e>0&&i>0&&n>0}function SE(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=OM(t,null==r?void 0:r.theme)[t.type],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible}=t.attribute,m=_E(d,u),y=bE(d,g),_=mE(h),v=yE(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return OA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function wE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function kE(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(s=Mt-St)e.moveTo(i+s*Et(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>St&&(e.moveTo(i+r*Et(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*Et(f),T=s*Bt(f),E=r*Et(y),P=r*Bt(y);let R,B,I,D;if((A>St||w>St)&&(R=s*Et(m),B=s*Bt(m),I=r*Et(_),D=r*Bt(_),hSt){const t=Rt(v,k),r=Rt(b,k),o=AE(I,D,C,T,s,t,Number(c)),l=AE(R,B,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Et(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+R,n+s*Bt(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>St)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>St){const t=Rt(S,M),s=Rt(x,M),o=AE(E,P,R,B,r,-s,Number(c)),l=AE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Et(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*Et(_),n+r*Bt(_))}return a?a[3]&&e.lineTo(i+s*Et(l),n+s*Et(l)):e.closePath(),d}class ME{static GetCanvas(){try{return ME.canvas||(ME.canvas=Wk.global.createCanvas({})),ME.canvas}catch(t){return null}}static GetCtx(){if(!ME.ctx){const t=ME.GetCanvas();ME.ctx=t.getContext("2d")}return ME.ctx}}class CE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=ME.GetCanvas(),n=ME.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=CE.dataMap.get(i);return n||(n=new CE(t,e),CE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){CE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return CE.dataMap.get(t)}}CE.dataMap=new Map;class TE{static GetSize(t){for(let e=0;e=t)return TE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=TE.GenKey(t,e,i,n,s),l=TE.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=TE.GenKey(t,e,i,n,s);TE.cache[l]?TE.cache[l].push({width:a,height:o,pattern:r}):TE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}TE.cache={},TE.ImageSize=[20,40,80,160,320,640,1280,2560];const EE=Symbol.for("ArcRenderContribution"),PE=Symbol.for("AreaRenderContribution"),RE=Symbol.for("CircleRenderContribution"),BE=Symbol.for("GroupRenderContribution"),IE=Symbol.for("ImageRenderContribution"),DE=Symbol.for("PathRenderContribution"),LE=Symbol.for("PolygonRenderContribution"),OE=Symbol.for("RectRenderContribution"),FE=Symbol.for("SymbolRenderContribution"),zE=Symbol.for("TextRenderContribution"),HE=Symbol.for("InteractiveSubRenderContribution");var jE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VE=function(t,e){return function(i,n){e(i,n,t)}};let WE=class{constructor(t){this.arcRenderContribitions=t,this.numberType=DT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Ct(d-c),p=d>c;let g=!1;if(sSt||M>St)&&(D=s*Et(v),L=s*Bt(v),O=r*Et(x),F=r*Bt(x),uSt){const t=Rt(S,T),r=Rt(w,T),a=AE(O,F,P,R,s,t,Number(p)),o=AE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>St)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>St){const t=Rt(k,E),s=Rt(A,E),a=AE(B,I,D,L,r,-s,Number(p)),o=AE(P,R,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Et(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,l){const h=OM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x:_=h.x,y:v=h.y}=t.attribute,b=_E(p,g),x=bE(p,m),S=mE(c),w=yE(u,f);if(!t.valid||!y)return;if(!(S||w||d))return;if(!(b||x||a||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=!1;const{isFullStroke:E,stroke:P}=(t=>{var e;let i=!0;if(o(t,!0)){for(let n=0;n<4;n++)yC[n]=t,i&&(i=!(null!==(e=yC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)yC[e]=!!t[e],i&&(i=!!yC[e]);else yC[0]=!1,yC[1]=!1,yC[2]=!1,yC[3]=!1;return{isFullStroke:i,stroke:yC}})(u);if(S||E||d){if(e.beginPath(),kE(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===RA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,_-i,v-n,h),e.fill())),w&&E&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,_-i,v-n,h),e.stroke()))}if(!E&&w){if(e.beginPath(),kE(t,e,i,n,A,k,P),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===RA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if(M&&C){const{startAngle:r,endAngle:o}=t.getParsedAngle();if(Ct(o-r)>=Mt-St){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:o=h.endAngle,fill:c=h.fill}=t.attribute,d=o;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===RA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),aT(o.color,l.color,h,!1)}(0,0,o,s);a||_E&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=OM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};WE=jE([Yw(),VE(0,Kw(tA)),VE(0,Xw(EE)),NE("design:paramtypes",[Object])],WE);var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},YE=function(t,e){return function(i,n){e(i,n,t)}};let XE=class{constructor(t){this.circleRenderContribitions=t,this.numberType=FT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=_E(y,f),w=bE(y,m),A=mE(h),k=yE(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};XE=UE([Yw(),YE(0,Kw(tA)),YE(0,Xw(RE)),GE("design:paramtypes",[Object])],XE);const $E=["radius","startAngle","endAngle",...AT];class KE extends ET{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=FT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=OM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Wk.graphicService.updateCircleAABBBounds(i,OM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=vC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).circle[t]}needUpdateTags(t){for(let e=0;e<$E.length;e++){const i=$E[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$E.length;e++)if(t===$E[e])return!0;return!1}toCustomPath(){var t,e,i;const n=this.attribute,s=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new uk;return o.arc(0,0,s,r,a),o}clone(){return new KE(Object.assign({},this.attribute))}}function qE(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function ZE(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function JE(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class QE{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=KT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=OM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=OM(this).text,n=Wk.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=ZE(c,s),e=JE(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=ZE(c,s),_=JE(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=OM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const g=Wk.graphicUtil.textMeasure,f=new QE(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).text[t]}needUpdateTags(t){for(let e=0;e{VP[t.type]=t}));const WP=["symbolType","size",...AT];let UP=class t extends ET{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=$T}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return m(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=OM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=VP[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new uk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Pt(r,a);return s.transform(0,0,o,o),this._parsedPath=new NP(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=OM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Wk.graphicService.updateSymbolAABBBounds(i,OM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=vC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=NT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=AC(i,n,e))}doUpdateAABBBounds(){const t=OM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateLineAABBBounds(e,OM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const XP=["width","height","cornerRadius",...AT];class $P extends ET{constructor(t){super(t),this.type="rect",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=OM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateRectAABBBounds(e,OM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).rect[t]}needUpdateTags(t){for(let e=0;e{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=Wk.graphicService.updateGlyphAABBBounds(this.attribute,OM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new ZP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const JP={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},QP=!0,tR=!1,eR=/\w|\(|\)/,iR=/[.?!,;:/,。?!、;:]/,nR=/\S/;function sR(t,e,i,n,s){if(!e||e<=0)return 0;const r=Wk.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=function(t,e){let i=e;for(;eR.test(t[i-1])&&eR.test(t[i])||iR.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function rR(t,e){const i=Wk.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class aR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=JP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class oR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=rR(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=rR(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=sR(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=rR(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||tR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||QP;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=sR(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=rR(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const lR=["width","height","image",...AT];class hR extends ET{constructor(t){super(t),this.type="image",this.numberType=jT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=OM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateImageAABBBounds(e,OM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lk[t]}needUpdateTags(t){for(let e=0;e{if(m(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=vC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Lk.width,height:e=Lk.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class dR{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof cR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=JP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof oR){const e=nR.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof cR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=rR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof cR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof cR)break;const{width:n}=rR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof cR?t.width:t.getWidthWithEllips(this.direction)})),e}}class uR{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=JP[this.direction]}store(t){if(t instanceof cR){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new dR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof cR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=sR(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new oR(i,t.newLine,t.character),new oR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const pR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...AT];class gR extends ET{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=XT}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dk.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Dk.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Dk.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Dk.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Dk.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Dk.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Dk.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Dk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=OM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateRichTextAABBBounds(e,OM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new uR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const fR=["path","customPath",...AT];class mR extends ET{constructor(t){super(t),this.type="path",this.numberType=VT}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=OM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof uk?e.path:(h(this.cache)&&this.doUpdatePathShape(),this.cache instanceof uk?this.cache:t.path)}doUpdateAABBBounds(){const t=OM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updatePathAABBBounds(e,OM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;f(t.path,!0)?this.cache=(new uk).fromString(t.path):t.customPath&&(this.cache=new uk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new _R(Object.assign({},this.attribute))}}const vR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...AT];class bR extends ET{constructor(t){super(t),this.type="arc",this.numberType=DT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=OM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(v(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=OM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Xt(e),i=e+r,n&&Ct(r)St&&o>St)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=OM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=It(n*n+s*s)}=this.attribute,o=Ct(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>St&&a>St){const i=e>t?1:-1;let r=Ot(Number(a)/s*Bt(u)),o=Ot(Number(a)/n*Bt(u));return(p-=2*r)>St?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>St?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=OM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Wk.graphicService.updateArcAABBBounds(i,OM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=vC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Mt-St)o.moveTo(0+s*Et(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>St&&(o.moveTo(0+n*Et(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Et(e),r=s*Bt(e),l=n*Et(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new bR(Object.assign({},this.attribute))}}class xR extends bR{constructor(t){super(t),this.type="arc3d",this.numberType=LT}doUpdateAABBBounds(){const t=OM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateArc3dAABBBounds(e,OM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const SR=["points","cornerRadius",...AT];class wR extends ET{constructor(t){super(t),this.type="polygon",this.numberType=WT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=OM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updatePolygonAABBBounds(e,OM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=AC(i,n,e))}getDefaultAttribute(t){return OM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new wR(Object.assign({},this.attribute))}}class AR extends wR{constructor(t){super(t),this.type="pyramid3d",this.numberType=UT}doUpdateAABBBounds(){const t=OM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updatePyramid3dAABBBounds(e,OM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var kR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let MR=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};MR=kR([Yw()],MR);var CR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const TR=Symbol.for("RectBoundsContribution");let ER=class extends MR{};ER=CR([Yw()],ER);var PR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const RR=Symbol.for("SymbolBoundsContribution");let BR=class extends MR{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;RT(i,n+r+o/2,!0,a)}return i}};BR=PR([Yw()],BR);var IR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const DR=Symbol.for("CircleBoundsContribution");let LR=class extends MR{};LR=IR([Yw()],LR);var OR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const FR=Symbol.for("ArcBoundsContribution");let zR=class extends MR{};zR=OR([Yw()],zR);var HR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const jR=Symbol.for("PathBoundsContribution");let NR=class extends MR{};NR=HR([Yw()],NR);class VR{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return VR.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XR=function(t,e){return function(i,n){e(i,n,t)}};function $R(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function KR(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function qR(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function ZR(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),$R(t,t,[s+o,r+l,a+h]),$R(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),$R(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=UR.allocate(),n=[0,0];if(y){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}$R(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),$R(i,i,[-n[0],-n[1],0]),qR(t,t,i)}}let JR=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new sA(["graphic"]),onSetStage:new sA(["graphic","stage"]),onRemove:new sA(["graphic"]),onAddIncremental:new sA(["graphic","group","stage"]),onClearIncremental:new sA(["graphic","group","stage"]),beforeUpdateAABBBounds:new sA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new sA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Wt,this.tempAABBBounds2=new Wt}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new uA(t);return OA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),Nt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Mt-St?i.set(-a,-a,a,a):SC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=St?i.set(0,0,0,0):Math.abs(a-o)>Mt-St?i.set(-s,-s,s,s):(SC(o,a,s,i),SC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(m(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){RT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){RT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Nt(e,e,s.transMatrix)}};JR=GR([Yw(),XR(0,Kw(ZT)),XR(1,Kw(tA)),XR(1,Xw(TR)),XR(2,Kw(tA)),XR(2,Xw(RR)),XR(3,Kw(tA)),XR(3,Xw(DR)),XR(4,Kw(tA)),XR(4,Xw(FR)),XR(5,Kw(tA)),XR(5,Xw(jR)),YR("design:paramtypes",[Object,Object,Object,Object,Object,Object])],JR);class QR extends QT{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const tB=["heightLimit","lineClamp"];class eB extends eP{_isValid(){const{text:t}=this.attribute;return m(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=OM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=Wk.graphicUtil.textMeasure,f=new QE(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=UR.allocate(),s=UR.allocate();ZR(s,t,e),qR(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),UR.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,y,_,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function bB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),xB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=EA.ROW:"y"===n?c=EA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wB=class extends vB{constructor(){super(...arguments),this.numberType=NT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const y=null!==(f=this.z)&&void 0!==f?f:0;bB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:y}),u.cache&&!m(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:_=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,_-c,v-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,_-c,v-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=_E(d,u),y=bE(d,p),_=mE(h),v=yE(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined),s=dk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=dk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],Rt(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function AB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),kB(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),kB(t,l,1,n),o=!1):o=!0}t.closePath()}function kB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=NA(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}wB=SB([Yw()],wB);var MB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TB=function(t,e){return function(i,n){e(i,n,t)}};function EB(t,e,i){switch(e){case"linear":default:return KA(t,i);case"basis":return JA(t,i);case"monotoneX":return rk(t,i);case"monotoneY":return ak(t,i);case"step":return lk(t,.5,i);case"stepBefore":return lk(t,0,i);case"stepAfter":return lk(t,1,i);case"linearClosed":return ck(t,i)}}let PB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=OT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=OM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=_E(y,m),A=mE(f),k=yE(b,x),M=bE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=EB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=EB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const r=EB(i,n),a=EB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],Rt(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=OM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?EA.ROW:EA.COLUMN,Number.isFinite(c)||(o=EA.COLUMN),Number.isFinite(d)||(o=EA.ROW);const u=i*(o===EA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===RA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,y-h,_-c,o),t.fill())),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;m(i)&&i[0]&&!1===i[1]&&(t.beginPath(),bB(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,y-h,_-c,o),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===RA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1}};PB=MB([Yw(),TB(0,Kw(tA)),TB(0,Xw(PE)),CB("design:paramtypes",[Object])],PB);var RB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IB=function(t,e){return function(i,n){e(i,n,t)}};let DB=class extends vB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=OM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=_E(f,p),w=bE(f,g),A=mE(d),k=yE(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)OA(t.pathShape.commandList,e,i,n,1,1,x);else{OA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};DB=RB([Yw(),IB(0,Kw(tA)),IB(0,Xw(DE)),BB("design:paramtypes",[Object])],DB);const LB=wt/2;function OB(t,e,i,n,s,r){let a;if(v(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!U(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-LB,0,!1)}if(t.lineTo(_[0],_[1]),!U(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,LB,!1)}if(t.lineTo(b[0],b[1]),!U(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],LB,wt,!1)}if(t.lineTo(g[0],g[1]),!U(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],wt,wt+LB,!1)}return t.closePath(),t}var FB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HB=function(t,e){return function(i,n){e(i,n,t)}};let jB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:y=l.fillOpacity,lineWidth:_=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=vE(f,y,u,p),A=xE(f,v,u,p),k=mE(h),M=yE(d,_);if(!t.valid||!b)return;if(!(k||M||c))return;if(!(w||A||a||o||c))return;0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),OB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};jB=FB([Yw(),HB(0,Kw(tA)),HB(0,Xw(OE)),zB("design:paramtypes",[Object])],jB);var NB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class extends vB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=$T}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=_E(f,p),A=bE(f,g),k=mE(d),M=yE(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};UB=NB([Yw(),WB(0,Kw(tA)),WB(0,Xw(FE)),VB("design:paramtypes",[Object])],UB);var GB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XB=function(t,e){return function(i,n){e(i,n,t)}};let $B=class extends vB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=_E(f,p),C=bE(f,g),T=mE(d),E=yE(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const P=!b,R=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===RA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,R,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,R);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,R,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,R);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,R))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,R),this.drawUnderLine(_,v,t,i,n+r,R,h,e)))}P&&this.restoreTransformUseContext2d(t,h,R,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=ZE(l,g),m=JE(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=ZE(h,a),f=JE("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};$B=GB([Yw(),XB(0,Kw(tA)),XB(0,Xw(zE)),YB("design:paramtypes",[Object])],$B);var KB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qB=class{};function ZB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iI=function(t,e){return function(i,n){e(i,n,t)}};let nI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:y=l.lineWidth,opacity:_=l.opacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=_E(_,p),w=bE(_,f),A=mE(c),k=yE(d,y);t.valid&&v&&(A||k||g)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||m(u)&&u.every((t=>0===t))?ZB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)ZB(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=QB(l,y,_,c,d),S=QB(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=JB(w,A),M=QB(l,JB(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};nI=tI([Yw(),iI(0,Kw(tA)),iI(0,Xw(LE)),eI("design:paramtypes",[Object])],nI);var sI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aI=function(t,e){return function(i,n){e(i,n,t)}};const oI=["","repeat-x","repeat-y","repeat"];let lI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a){const o=OM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=_E(d,u),_=mE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,oI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=OM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};lI=sI([Yw(),aI(0,Kw(tA)),aI(0,Xw(IE)),rI("design:paramtypes",[Object])],lI);const hI=Symbol.for("IncrementalDrawContribution"),cI=Symbol.for("ArcRender"),dI=Symbol.for("Arc3dRender"),uI=Symbol.for("AreaRender"),pI=Symbol.for("CircleRender"),gI=Symbol.for("GraphicRender"),fI=Symbol.for("GroupRender"),mI=Symbol.for("LineRender"),yI=Symbol.for("PathRender"),_I=Symbol.for("PolygonRender"),vI=Symbol.for("RectRender"),bI=Symbol.for("Rect3DRender"),xI=Symbol.for("SymbolRender"),SI=Symbol.for("TextRender"),wI=Symbol.for("RichTextRender"),AI=Symbol.for("Pyramid3dRender"),kI=Symbol.for("GlyphRender"),MI=Symbol.for("ImageRender"),CI=Symbol.for("RenderSelector"),TI=Symbol.for("DrawContribution");function EI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function PI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(m(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const RI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Yk(Object.assign({nativeCanvas:Wk.global.createCanvas(t)},t));const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr};return Yk(Object.assign({nativeCanvas:Wk.global.createCanvas(e)},e))}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};var BI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},II=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DI=function(t,e){return function(i,n){e(i,n,t)}};let LI=class{constructor(){this.time=RA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=OM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};LI=BI([Yw()],LI);let OI=class{constructor(t){this.subRenderContribitions=t,this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};OI=BI([Yw(),DI(0,Kw(tA)),DI(0,Xw(HE)),II("design:paramtypes",[Object])],OI);let FI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=RI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return RI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Mt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};FI=BI([Yw()],FI);var zI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=EI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),kE(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=EI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),kE(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};HI=zI([Yw()],HI);let jI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};jI=zI([Yw()],jI);let NI=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};NI=zI([Yw()],NI);var VI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=EI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=EI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};WI=VI([Yw()],WI);let UI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};UI=VI([Yw()],UI);let GI=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};GI=VI([Yw()],GI);var YI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let XI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};XI=YI([Yw()],XI);var $I=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=OM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};KI=$I([Yw()],KI);var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=EI(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),OB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=EI(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),OB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};ZI=qI([Yw()],ZI);let JI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};JI=qI([Yw()],JI);let QI=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};QI=qI([Yw()],QI);let tD=class{constructor(){this.time=RA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};tD=qI([Yw()],tD);let eD=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};eD=qI([Yw()],eD);var iD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let nD=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=EI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=EI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};nD=iD([Yw()],nD);class sD extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}}class rD extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}}var aD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lD=function(t,e){return function(i,n){e(i,n,t)}};const hD=Symbol.for("RenderService");let cD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};cD=aD([Yw(),lD(0,Kw(TI)),oD("design:paramtypes",[Object])],cD);var dD=new Nw((t=>{t(cD).toSelf(),t(hD).toService(cD)})),uD=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function pD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return uD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function fD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var mD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const yD=Symbol.for("PickItemInterceptor");let _D=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===LT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};_D=mD([Yw()],_D);var vD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xD=function(t,e){return function(i,n){e(i,n,t)}};const SD=Symbol.for("PickerService");let wD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new qt(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=UR.allocate();if(KR(i,e),a){if(i){const t=UR.allocate();r.modelMatrix=qR(t,a,i),UR.free(i)}}else KR(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Ht(e.x,e.y),a=OM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Ht(e.x,e.y);l.transformPoint(r,r);const a=OM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&UR.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),WR.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};wD=vD([Yw(),xD(0,Kw(aA)),xD(1,Kw(tA)),xD(1,Xw(yD)),bD("design:paramtypes",[Object,Object])],wD);var AD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},MD=function(t,e){return function(i,n){e(i,n,t)}};const CD=Symbol.for("GlobalPickerService");let TD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new qt(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Ht(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function ED(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function PD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}TD=AD([Yw(),MD(0,Kw(aA)),kD("design:paramtypes",[Object])],TD);class RD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=UR.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=UR.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ID=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const DD=[0,0,0],LD=new qt(1,0,0,1,0,0);let OD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},mk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},_k),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new qt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return WR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Mt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&TE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(PD(DD,[t,e,i],this.modelMatrix),t=DD[0],e=DD[1],i=DD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(PD(DD,[t,e,i],this.modelMatrix),t=DD[0],e=DD[1],i=DD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(PD(DD,[e,i,n],this.modelMatrix),e=DD[0],i=DD[1],n=DD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wk.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Wk.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:vk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:vk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(PD(DD,[e,i,n],this.modelMatrix),e=DD[0],i=DD[1],n=DD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=PI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=EI(this,l,this.dpr),r.strokeStyle=PI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=qE(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=qE(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(LD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>WR.free(t))),this.stack.length=0}};OD.env="browser",OD=BD([Yw(),ID("design:paramtypes",[Object,Number])],OD);var FD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const HD={WIDTH:500,HEIGHT:500,DPR:1};let jD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=HD.WIDTH,height:n=HD.HEIGHT,dpr:s=HD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=Wk.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new OD(this,this._dpr),this._id=e.id,this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};jD.env="browser",jD=FD([Yw(),zD("design:paramtypes",[Object])],jD);const ND=Symbol.for("CanvasArcPicker"),VD=Symbol.for("CanvasArc3dPicker"),WD=Symbol.for("CanvasAreaPicker"),UD=Symbol.for("CanvasCirclePicker"),GD=Symbol.for("CanvasImagePicker"),YD=Symbol.for("CanvasLinePicker"),XD=Symbol.for("CanvasPathPicker"),$D=Symbol.for("CanvasRectPicker"),KD=Symbol.for("CanvasRect3dPicker"),qD=Symbol.for("CanvasSymbolPicker"),ZD=Symbol.for("CanvasTextPicker"),JD=Symbol.for("CanvasPolygonPicker"),QD=Symbol.for("CanvasPyramid3dPicker"),tL=Symbol.for("CanvasRichTextPicker"),eL=Symbol.for("CanvasGlyphPicker"),iL=Symbol.for("CanvasPickerContribution"),nL=Symbol.for("MathArcPicker"),sL=Symbol.for("MathAreaPicker"),rL=Symbol.for("MathCirclePicker"),aL=Symbol.for("MathLinePicker"),oL=Symbol.for("MathPathPicker"),lL=Symbol.for("MathRectPicker"),hL=Symbol.for("MathSymbolPicker"),cL=Symbol.for("MathTextPicker"),dL=Symbol.for("MathPolygonPicker"),uL=Symbol.for("MathGlyphPicker"),pL=Symbol.for("MathPickerContribution");var gL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mL=function(t,e){return function(i,n){e(i,n,t)}};let yL=class extends wD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new jD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bL=new qt(1,0,0,1,0,0),xL={x:0,y:0};let SL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0),this.path=new uk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return WR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},xL),function(t,e,i){return xM(t,0,!1,e,i)}(this.path.commandList,xL.x,xL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},xL);const i=EI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return xM(t,e,!0,i,n)}(this.path.commandList,i,xL.x,xL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(bL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>WR.free(t))),this.stack.length=0}};SL=_L([Yw(),vL("design:paramtypes",[Object,Number])],SL);var wL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kL=function(t,e){return function(i,n){e(i,n,t)}};let ML=class extends wD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new SL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};wL([Qw(),AL("design:type",Function),AL("design:paramtypes",[]),AL("design:returntype",void 0)],ML.prototype,"init",null),ML=wL([Yw(),kL(0,Kw(tA)),kL(0,Xw(pL)),kL(1,Kw(aA)),kL(2,Kw(tA)),kL(2,Xw(yD)),AL("design:paramtypes",[Object,Object,Object])],ML);var CL=new Nw((t=>{t(yL).toSelf().inSingletonScope(),t(ML).toSelf().inSingletonScope(),t(SD).toService(yL),t(TD).toSelf().inSingletonScope(),t(CD).toService(TD),t(_D).toSelf().inSingletonScope(),t(yD).toService(_D),iA(t,yD)})),TL=new Nw((t=>{t(JR).toSelf().inSingletonScope(),t(qT).toService(JR),t(ER).toSelf().inSingletonScope(),t(TR).toService(ER),iA(t,TR),t(BR).toSelf().inSingletonScope(),t(RR).toService(BR),iA(t,RR),t(LR).toSelf().inSingletonScope(),t(DR).toService(LR),iA(t,DR),t(zR).toSelf().inSingletonScope(),t(FR).toService(zR),iA(t,FR),t(NR).toSelf().inSingletonScope(),t(jR).toService(NR),iA(t,jR),t(ZT).toConstantValue(fB)}));const EL=Symbol.for("AutoEnablePlugins"),PL=Symbol.for("PluginService");var RL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IL=function(t,e){return function(i,n){e(i,n,t)}};let DL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Vk.isBound(EL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};DL=RL([Yw(),IL(0,Kw(tA)),IL(0,Xw(EL)),BL("design:paramtypes",[Object])],DL);var LL=new Nw((t=>{t(DL).toSelf(),t(PL).toService(DL),iA(t,EL)})),OL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let FL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}};FL=OL([Yw()],FL);var zL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function jL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let NL=class extends FL{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(b(o)?o:1),y:(s-r.top)/(b(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return jL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return jL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:FM.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}};function VL(){Vk.rebind(SD).toService(ML)}NL=zL([Yw(),HL("design:paramtypes",[])],NL);var WL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GL=class extends FL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),VL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};GL=WL([Yw(),UL("design:paramtypes",[])],GL);var YL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $L=class extends FL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Vk.rebind(SD).toService(ML))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};$L=YL([Yw(),XL("design:paramtypes",[])],$L);var KL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZL=!1;try{ZL=!!lynx.createCanvasNG}catch(t){}let JL=class extends FL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=ZL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,ZL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),VL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};JL=KL([Yw(),qL("design:paramtypes",[])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tO=class extends FL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};tO=QL([Yw()],tO);var eO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let sO=class extends FL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return nO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{VL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};sO=eO([Yw(),iO("design:paramtypes",[])],sO);var rO=new Nw((t=>{t(NL).toSelf().inSingletonScope(),t(rA).toService(NL),t(GL).toSelf().inSingletonScope(),t(rA).toService(GL),t($L).toSelf().inSingletonScope(),t(rA).toService($L),t(JL).toSelf().inSingletonScope(),t(rA).toService(JL),t(sO).toSelf().inSingletonScope(),t(rA).toService(sO),t(tO).toSelf().inSingletonScope(),t(rA).toService(tO),iA(t,rA)})),aO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lO=class{constructor(){this._uid=FM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};lO=aO([Yw(),oO("design:paramtypes",[])],lO);var hO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dO=function(t,e){return function(i,n){e(i,n,t)}};let uO=class extends lO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:FM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new jD(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new jD({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};uO.env="browser",uO=hO([Yw(),dO(0,Kw(aA)),cO("design:paramtypes",[Object])],uO);var pO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gO=class extends OD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};gO.env="feishu",gO=pO([Yw()],gO);var fO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const yO={WIDTH:500,HEIGHT:500,DPR:1};let _O=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=yO.WIDTH,height:n=yO.HEIGHT,dpr:s=yO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new gO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};_O.env="feishu",_O=fO([Yw(),mO("design:paramtypes",[Object])],_O);var vO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xO=function(t,e){return function(i,n){e(i,n,t)}};let SO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new _O(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new _O({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};SO.env="feishu",SO=vO([Yw(),xO(0,Kw(aA)),bO("design:paramtypes",[Object])],SO);var wO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let AO=class extends OD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(PI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(EI(this,l,this.dpr)),r.setStrokeStyle(PI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=qE(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=qE(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};AO.env="taro",AO=wO([Yw()],AO);var kO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const CO={WIDTH:500,HEIGHT:500,DPR:1};let TO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=CO.WIDTH,height:n=CO.HEIGHT,dpr:s=CO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new AO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};TO.env="taro",TO=kO([Yw(),MO("design:paramtypes",[Object])],TO);var EO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RO=function(t,e){return function(i,n){e(i,n,t)}};let BO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new TO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new TO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};BO.env="taro",BO=EO([Yw(),RO(0,Kw(aA)),PO("design:paramtypes",[Object])],BO);var IO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let DO=class extends OD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=EI(this,l,this.dpr),r.strokeStyle=PI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};DO.env="lynx",DO=IO([Yw()],DO);var LO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const FO={WIDTH:500,HEIGHT:500,DPR:1};let zO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=FO.WIDTH,height:n=FO.HEIGHT,dpr:s=FO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new DO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};zO.env="lynx",zO=LO([Yw(),OO("design:paramtypes",[Object])],zO);var HO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NO=function(t,e){return function(i,n){e(i,n,t)}};let VO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new zO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};VO.env="lynx",VO=HO([Yw(),NO(0,Kw(aA)),jO("design:paramtypes",[Object])],VO);var WO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GO=class extends OD{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};GO.env="node",GO=WO([Yw(),UO("design:paramtypes",[Object,Number])],GO);var YO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const $O={WIDTH:500,HEIGHT:500,DPR:1};let KO=class{get id(){return this._id}get x(){return 0}get y(){return 0}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=$O.WIDTH,height:n=$O.HEIGHT,canvasControled:s=!0,dpr:r=$O.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new GO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&l(this._nativeCanvas.release)&&this._nativeCanvas.release()}};KO.env="node",KO=YO([Yw(),XO("design:paramtypes",[Object])],KO);var qO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JO=function(t,e){return function(i,n){e(i,n,t)}};let QO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new KO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new KO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};QO.env="node",QO=qO([Yw(),JO(0,Kw(aA)),ZO("design:paramtypes",[Object])],QO);var tF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eF=class extends OD{draw(){}createPattern(t,e){return null}};eF.env="wx",eF=tF([Yw()],eF);var iF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const sF={WIDTH:500,HEIGHT:500,DPR:1};let rF=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=sF.WIDTH,height:n=sF.HEIGHT,dpr:s=sF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new eF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};rF.env="wx",rF=iF([Yw(),nF("design:paramtypes",[Object])],rF);var aF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lF=function(t,e){return function(i,n){e(i,n,t)}};class hF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let cF=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new hF}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new rF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new rF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};cF.env="wx",cF=aF([Yw(),lF(0,Kw(aA)),oF("design:paramtypes",[Object])],cF);var dF=new Nw((t=>{t(uO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(uO))).whenTargetNamed(uO.env),t(SO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(SO))).whenTargetNamed(SO.env),t(BO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(BO))).whenTargetNamed(BO.env),t(VO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(VO))).whenTargetNamed(VO.env),t(cF).toSelf(),t(cE).toDynamicValue((t=>t.container.get(cF))).whenTargetNamed(cF.env),t(QO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(QO))).whenTargetNamed(QO.env)})),uF=new Nw((t=>{t(Nk).toSelf().inSingletonScope(),t(jk).toService(Nk),iA(t,jk)})),pF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fF=function(t,e){return function(i,n){e(i,n,t)}};let mF=class{constructor(t){this.global=t,this.offscreen=!1}init(t,e,i){if(this.layer=t,i.main)this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Yk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};mF=pF([Yw(),fF(0,Kw(aA)),gF("design:paramtypes",[Object])],mF);var yF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vF=function(t,e){return function(i,n){e(i,n,t)}};let bF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=Yk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};bF=yF([Yw(),vF(0,Kw(aA)),_F("design:paramtypes",[Object])],bF);var xF=new Nw((t=>{t(mF).toSelf(),t(bF).toSelf(),t(tE).toService(mF)}));var SF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const wF=Symbol.for("DrawItemInterceptor"),AF=new Wt;let kF=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){AF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(AF),!0}};kF=SF([Yw()],kF);let MF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=UR.allocate();KR(l,o);const h=r.modelMatrix;if(h){if(l){const t=UR.allocate();r.modelMatrix=qR(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===LT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&UR.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};MF=SF([Yw()],MF);var CF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EF=function(t,e){return function(i,n){e(i,n,t)}};let PF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=(h=l,c=n.dirtyBounds,d=!1,null===h?c:null===c?h:(ce=h.x1,de=h.x2,ue=h.y1,pe=h.y2,ge=c.x1,fe=c.x2,me=c.y1,ye=c.y2,d&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>=fe||de<=ge||ue>=ye||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ye)}));l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}var h,c,d;this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const u=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),u&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:xk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:xk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=fD(e,i,xk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(!xe(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):pD(t,xk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Vk.get(hI);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let BF=class{selector(t){return null}};BF=RF([Yw()],BF);var IF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LF=function(t,e){return function(i,n){e(i,n,t)}};let OF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=HT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:y=l.fillOpacity,strokeOpacity:_=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=vE(u,y,p,g),A=xE(u,_,p,g),k=mE(h),M=yE(d,x);if(!t.valid||!S)return;if(!f){if(!(k||M||c))return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===v||m(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),OB(e,i,n,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=OM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=UR.allocate(),i=UR.allocate();ZR(i,t,a),qR(e,o||e,i),s.modelMatrix=e,UR.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&UR.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};OF=IF([Yw(),LF(0,Kw(tA)),LF(0,Xw(BE)),DF("design:paramtypes",[Object])],OF);var FF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zF=class extends wB{constructor(){super(...arguments),this.numberType=NT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=OM(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,y=_E(u,p),_=bE(u,g),v=mE(c),b=yE(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};zF=FF([Yw()],zF);var HF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jF=class extends PB{constructor(){super(...arguments),this.numberType=OT}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=OM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=_E(u,d),f=mE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};jF=HF([Yw()],jF);var NF,VF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UF=function(t,e){return function(i,n){e(i,n,t)}},GF=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(NF||(NF={}));let YF=class extends PF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=NF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new sA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return GF(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:xk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:xk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return GF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return GF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>GF(this,void 0,void 0,(function*(){if(2!==t.count)yield gD(t,xk.zIndex,((i,n)=>{if(this.status===NF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return GF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return GF(this,void 0,void 0,(function*(){this.rendering&&(this.status=NF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=NF.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return GF(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>GF(this,void 0,void 0,(function*(){yield gD(t,xk.zIndex,(t=>GF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};VF([Kw(aA),WF("design:type",Object)],YF.prototype,"global",void 0),YF=VF([Yw(),UF(0,qw(gI)),UF(1,Kw(CI)),UF(2,Kw(zF)),UF(3,Kw(jF)),UF(4,Kw(gE)),UF(5,Kw(tA)),UF(5,Xw(wF)),WF("design:paramtypes",[Array,Object,Object,Object,Object,Object])],YF);var XF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $F=class extends vB{constructor(){super(...arguments),this.type="rect3d",this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=vE(g,f,u,p),x=xE(g,y,u,p),S=mE(c),w=yE(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=iT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=OM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};$F=XF([Yw()],$F);var KF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qF=class{constructor(){this.numberType=XT}drawShape(t,e,i,n,s){const r=OM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&_E(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=OM(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),OB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=OM(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};qF=KF([Yw()],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JF=class{constructor(){this.numberType=zT}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=OM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};JF=ZF([Yw()],JF);var QF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tz=class extends vB{constructor(){super(...arguments),this.numberType=LT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=_E(p,g),v=bE(p,m),b=mE(c),x=yE(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=iT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(r=Mt-St)e.moveTo(i+r*Et(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>St&&(e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*Et(p),_=r*Bt(p),v=a*Et(f),b=a*Bt(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>St)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Mt,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Ct(h-l),d=h>l;let u=!1;if(a<=St)e.moveTo(i,n,s);else if(c>=Mt-St)e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Et(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Et(c),f=a*Bt(c),m=a*Et(p),y=a*Bt(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=OM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};tz=QF([Yw()],tz);var ez=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iz=class extends vB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=UT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=_E(u,p),x=bE(u,f),S=mE(c),w=yE(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=iT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=OM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};iz=ez([Yw()],iz);var nz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sz=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};sz=nz([Yw()],sz);let rz=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};rz=nz([Yw()],rz);var az=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let oz=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};oz=az([Yw()],oz);let lz=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};lz=az([Yw()],lz);var hz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cz=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};cz=hz([Yw()],cz);let dz=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:MC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:MC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:MC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:MC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};dz=hz([Yw()],dz);var uz=new Nw((t=>{t(PF).toSelf(),t(TI).toService(PF),t(YF).toSelf(),t(hI).toService(YF),t(BF).toSelf(),t(CI).toService(BF),t(XE).toSelf().inSingletonScope(),t(pI).to(XE),t(gI).to(XE),t(WI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(GI).toSelf().inSingletonScope(),t(RE).toService(WI),t(RE).toService(UI),t(RE).toService(GI),iA(t,RE),t(jB).toSelf().inSingletonScope(),t(vI).to(jB),t(gI).to(jB),t($F).toSelf().inSingletonScope(),t(bI).toService($F),t(gI).toService(bI),t(ZI).toSelf().inSingletonScope(),t(JI).toSelf().inSingletonScope(),t(QI).toSelf().inSingletonScope(),t(tD).toSelf().inSingletonScope(),t(eD).toSelf().inSingletonScope(),t(OE).toService(ZI),t(OE).toService(JI),t(OE).toService(QI),t(OE).toService(tD),t(OE).toService(eD),iA(t,OE),t($B).toSelf().inSingletonScope(),t(SI).to($B),t(gI).to($B),iA(t,zE),t(DB).toSelf().inSingletonScope(),t(yI).to(DB),t(gI).to(DB),t(oz).toSelf().inSingletonScope(),t(lz).toSelf().inSingletonScope(),t(DE).toService(oz),t(DE).toService(lz),iA(t,DE),t(UB).toSelf().inSingletonScope(),t(xI).to(UB),t(gI).to(UB),t(nD).toSelf().inSingletonScope(),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(FE).toService(nD),t(FE).toService(sD),t(FE).toService(rD),iA(t,FE),t(WE).toSelf().inSingletonScope(),t(cI).to(WE),t(gI).to(WE),t(tz).toSelf().inSingletonScope(),t(dI).toService(tz),t(gI).toService(dI),t(HI).toSelf().inSingletonScope(),t(jI).toSelf().inSingletonScope(),t(NI).toSelf().inSingletonScope(),t(EE).toService(HI),t(EE).toService(jI),t(EE).toService(NI),iA(t,EE),t(wB).toSelf().inSingletonScope(),t(mI).to(wB),t(gI).to(wB),t(zF).toSelf().inSingletonScope(),t(jF).toSelf().inSingletonScope(),t(PB).toSelf().inSingletonScope(),t(uI).to(PB),t(gI).to(PB),t(cz).toSelf().inSingletonScope(),t(dz).toSelf().inSingletonScope(),t(PE).toService(cz),t(PE).toService(dz),iA(t,PE),t(OF).toSelf().inSingletonScope(),t(fI).to(OF),t(gI).to(OF),t(XI).toSelf().inSingletonScope(),t(BE).toService(XI),iA(t,BE),t(nI).toSelf().inSingletonScope(),t(_I).to(nI),t(gI).to(nI),t(sz).toSelf().inSingletonScope(),t(rz).toSelf().inSingletonScope(),t(LE).toService(sz),t(LE).toService(rz),iA(t,LE),t(JF).toSelf().inSingletonScope(),t(kI).toService(JF),t(gI).toService(kI),t(lI).toSelf().inSingletonScope(),t(MI).toService(lI),t(gI).toService(MI),t(KI).toSelf().inSingletonScope(),t(IE).toService(KI),iA(t,IE),t(qF).toSelf().inSingletonScope(),t(wI).toService(qF),t(gI).toService(wI),t(iz).toSelf().inSingletonScope(),t(AI).toService(iz),t(gI).toService(AI),t(OI).toSelf().inSingletonScope(),t(zE).toService(OI),t(EE).toService(OI),t(DE).toService(OI),t(FE).toService(OI),t(OE).toService(OI),t(IE).toService(OI),t(RE).toService(OI),t(PE).toService(OI),t(LE).toService(OI),iA(t,HE),iA(t,gI),t(kF).toSelf().inSingletonScope(),t(wF).toService(kF),t(MF).toSelf().inSingletonScope(),t(wF).toService(MF),iA(t,wF)}));var pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fz=function(t,e){return function(i,n){e(i,n,t)}};let mz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=FT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=EI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};mz=pz([Yw(),fz(0,Kw(pI)),gz("design:paramtypes",[Object])],mz);var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};const bz=new Wt;let xz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=EI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;bz.setValue(i.x1,i.y1,i.x2,i.y2),bz.expand(-r/2),h=!bz.containsPoint(e)}}return n.highPerformanceRestore(),h}};xz=yz([Yw(),vz(0,Kw(vI)),_z("design:paramtypes",[Object])],xz);var Sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Az=function(t,e){return function(i,n){e(i,n,t)}};let kz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=DT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=EI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kz=Sz([Yw(),Az(0,Kw(cI)),wz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=OT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Ez=Mz([Yw(),Tz(0,Kw(uI)),Cz("design:paramtypes",[Object])],Ez);var Pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Rz=class{constructor(){this.type="image",this.numberType=jT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Rz=Pz([Yw()],Rz);var Bz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Iz=class extends vB{};Iz=Bz([Yw()],Iz);var Dz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oz=function(t,e){return function(i,n){e(i,n,t)}};let Fz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=OM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=EI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Fz=Dz([Yw(),Oz(0,Kw(mI)),Lz("design:paramtypes",[Object])],Fz);var zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=EI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Nz=zz([Yw(),jz(0,Kw(yI)),Hz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Gz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=$T}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=OM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=EI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Gz=Vz([Yw(),Uz(0,Kw(xI)),Wz("design:paramtypes",[Object])],Gz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$z=function(t,e){return function(i,n){e(i,n,t)}};let Kz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=KT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=OM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=JE(a,u,s),y=ZE(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&UR.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Kz=Yz([Yw(),$z(0,Kw(SI)),Xz("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};let Qz=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=WT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Qz=qz([Yw(),Jz(0,Kw(_I)),Zz("design:paramtypes",[Object])],Qz);var tH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let nH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=XT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nH=tH([Yw(),iH(0,Kw(wI)),eH("design:paramtypes",[Object])],nH);var sH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aH=function(t,e){return function(i,n){e(i,n,t)}};let oH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};oH=sH([Yw(),aH(0,Kw(kI)),rH("design:paramtypes",[Object])],oH);var lH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let dH=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=YT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};dH=lH([Yw(),cH(0,Kw(bI)),hH("design:paramtypes",[Object])],dH);var uH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let fH=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};fH=uH([Yw(),gH(0,Kw(AI)),pH("design:paramtypes",[Object])],fH);var mH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_H=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let vH=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=LT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};vH=mH([Yw(),_H(0,Kw(dI)),yH("design:paramtypes",[Object])],vH);var bH=new Nw(((t,e,i,n)=>{t(mz).toSelf().inSingletonScope(),t(UD).toService(mz),t(iL).toService(UD),t(xz).toSelf().inSingletonScope(),t($D).toService(xz),t(iL).toService($D),t(dH).toSelf().inSingletonScope(),t(KD).toService(dH),t(iL).toService(KD),t(kz).toSelf().inSingletonScope(),t(ND).toService(kz),t(iL).toService(ND),t(Ez).toSelf().inSingletonScope(),t(WD).toService(Ez),t(iL).toService(WD),t(Rz).toSelf().inSingletonScope(),t(GD).toService(Rz),t(iL).toService(GD),t(Fz).toSelf().inSingletonScope(),t(YD).toService(Fz),t(iL).toService(YD),t(Nz).toSelf().inSingletonScope(),t(XD).toService(Nz),t(iL).toService(XD),t(Gz).toSelf().inSingletonScope(),t(qD).toService(Gz),t(iL).toService(qD),t(Kz).toSelf().inSingletonScope(),t(ZD).toService(Kz),t(iL).toService(ZD),t(Qz).toSelf().inSingletonScope(),t(JD).toService(Qz),t(iL).toService(JD),t(fH).toSelf().inSingletonScope(),t(QD).toService(fH),t(iL).toService(QD),t(vH).toSelf().inSingletonScope(),t(VD).toService(vH),t(iL).toService(VD),t(nH).toSelf().inSingletonScope(),t(tL).toService(nH),t(iL).toService(tL),t(oH).toSelf().inSingletonScope(),t(eL).toService(oH),t(iL).toService(eL),iA(t,iL)})),xH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wH=function(t,e){return function(i,n){e(i,n,t)}};let AH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};AH=xH([Yw(),wH(0,Kw(yI)),SH("design:paramtypes",[Object])],AH);var kH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CH=function(t,e){return function(i,n){e(i,n,t)}};let TH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=FT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};TH=kH([Yw(),CH(0,Kw(pI)),MH("design:paramtypes",[Object])],TH);var EH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RH=function(t,e){return function(i,n){e(i,n,t)}};const BH=new Wt;let IH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;BH.setValue(i.x1,i.y1,i.x2,i.y2),BH.expand(-r/2),h=!BH.containsPoint(e)}}return n.highPerformanceRestore(),h}};IH=EH([Yw(),RH(0,Kw(vI)),PH("design:paramtypes",[Object])],IH);var DH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OH=function(t,e){return function(i,n){e(i,n,t)}};let FH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=DT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};FH=DH([Yw(),OH(0,Kw(cI)),LH("design:paramtypes",[Object])],FH);var zH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jH=function(t,e){return function(i,n){e(i,n,t)}};let NH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=OT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};NH=zH([Yw(),jH(0,Kw(uI)),HH("design:paramtypes",[Object])],NH);var VH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let GH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};GH=VH([Yw(),UH(0,Kw(mI)),WH("design:paramtypes",[Object])],GH);var YH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$H=function(t,e){return function(i,n){e(i,n,t)}};let KH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=$T}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};KH=YH([Yw(),$H(0,Kw(xI)),XH("design:paramtypes",[Object])],KH);var qH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZH=class{constructor(){this.type="text",this.numberType=KT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};ZH=qH([Yw()],ZH);var JH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tj=function(t,e){return function(i,n){e(i,n,t)}};let ej=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=WT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ej=JH([Yw(),tj(0,Kw(_I)),QH("design:paramtypes",[Object])],ej);var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sj=function(t,e){return function(i,n){e(i,n,t)}};let rj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};rj=ij([Yw(),sj(0,Kw(kI)),nj("design:paramtypes",[Object])],rj);var aj=new Nw((t=>{t(TH).toSelf().inSingletonScope(),t(rL).toService(TH),t(pL).toService(rL),t(IH).toSelf().inSingletonScope(),t(lL).toService(IH),t(pL).toService(lL),t(FH).toSelf().inSingletonScope(),t(nL).toService(FH),t(pL).toService(nL),t(NH).toSelf().inSingletonScope(),t(sL).toService(NH),t(pL).toService(sL),t(GH).toSelf().inSingletonScope(),t(aL).toService(GH),t(pL).toService(aL),t(AH).toSelf().inSingletonScope(),t(oL).toService(AH),t(pL).toService(oL),t(KH).toSelf().inSingletonScope(),t(hL).toService(KH),t(pL).toService(hL),t(ZH).toSelf().inSingletonScope(),t(cL).toService(ZH),t(pL).toService(cL),t(ej).toSelf().inSingletonScope(),t(dL).toService(ej),t(pL).toService(dL),t(rj).toSelf().inSingletonScope(),t(uL).toService(rj),t(rj).toService(uL),iA(t,pL)}));var oj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new jD(t))).whenTargetNamed(jD.env),t(Gk).toDynamicValue((()=>(t,e)=>new OD(t,e))).whenTargetNamed(OD.env)})),lj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new TO(t))).whenTargetNamed(TO.env),t(Gk).toDynamicValue((()=>(t,e)=>new AO(t,e))).whenTargetNamed(AO.env)})),hj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new _O(t))).whenTargetNamed(_O.env),t(Gk).toDynamicValue((()=>(t,e)=>new gO(t,e))).whenTargetNamed(gO.env)})),cj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new zO(t))).whenTargetNamed(zO.env),t(Gk).toDynamicValue((()=>(t,e)=>new DO(t,e))).whenTargetNamed(DO.env)})),dj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new rF(t))).whenTargetNamed(rF.env),t(Gk).toDynamicValue((()=>(t,e)=>new eF(t,e))).whenTargetNamed(eF.env)})),uj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new KO(t))).whenTargetNamed(KO.env),t(Gk).toDynamicValue((()=>(t,e)=>new GO(t,e))).whenTargetNamed(GO.env)}));Vk.load(fE),Vk.load(TL),Vk.load(dD),Vk.load(CL),Vk.load(LL),function(t){t.load(rO),t.load(dF),t.load(uF),t.load(xF)}(Vk),function(t){t.load(uz)}(Vk),function(t){t.load(bH),t.load(aj)}(Vk),function(t){t.load(oj),t.load(hj),t.load(lj),t.load(cj),t.load(dj),t.load(uj)}(Vk);const pj=Vk.get(aA);Wk.global=pj;const gj=Vk.get(pE);Wk.graphicUtil=gj;const fj=Vk.get(uE);Wk.transformUtil=fj;const mj=Vk.get(qT);Wk.graphicService=mj,Vk.get(CD);const yj=Vk.get(gE);Wk.layerService=yj;class _j{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Wk.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Wk.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Wk.graphicService.hooks.onAttributeUpdate.taps=Wk.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.onSetStage.taps=Wk.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class vj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class bj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Wk.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Wk.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Wk.graphicService.hooks.onAddIncremental.taps=Wk.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.onClearIncremental.taps=Wk.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Wk.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const xj=new Wt;class Sj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Wk.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(xj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(xj,t.parent&&t.parent.globalTransMatrix)))})),Wk.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),Wk.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Wk.graphicService.hooks.beforeUpdateAABBBounds.taps=Wk.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.afterUpdateAABBBounds.taps=Wk.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.onRemove.taps=Wk.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const wj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===sC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=sC.INITIAL,Wk.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Wk.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:nC},{mode:"timeout",cons:iC},{mode:"manual",cons:eC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==sC.INITIAL&&(this.status=sC.PAUSE,!0)}resume(){return this.status!==sC.INITIAL&&(this.status=sC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===sC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===sC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=sC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=sC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};wj.addTimeline(aC),wj.setFPS(60);class Aj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=iT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=It(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Rt(Pt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=f(e)?iT.get(e).value:e;const r=this.colorRgb;return iT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const kj="white";class Mj extends QT{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:kj}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new DM,this.hooks={beforeRender:new sA(["stage"]),afterRender:new sA(["stage"])},this.global=Vk.get(aA),this.window=Vk.get(hE),this.renderService=Vk.get(hD),this.pickerService=Vk.get(SD),this.pluginService=Vk.get(PL),this.layerService=Vk.get(gE),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Wt,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:kj,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new qM({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||wj,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new Aj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new RD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new vj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new _j))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new bj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new Sj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive"}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Ht(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Vk.get(hE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Cj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Cj||(Cj={}));const Tj="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Ej=Tj,Pj=14,Rj=18,Bj=4,Ij={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Pj}}},Dj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Lj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Pj,offset:12,position:"outside"}}},Oj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Pj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Pj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Pj,fill:"#707070",textBaseline:"middle"}}},Fj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Pj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Pj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Pj,fill:"#707070",textBaseline:"middle"}}},zj="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",Hj={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:zj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:zj,fill:"#ddd"}}},jj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Nj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Vj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Pj,fontWeight:"normal",fillOpacity:1}}},Wj={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Pj}}},Uj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Gj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Yj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Pj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Pj}}},Xj={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Pj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Pj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Pj,textBaseline:"middle",textAlign:"center"}}},$j="__VCHART",Kj=500,qj=500,Zj=`${$j}_LABEL_LIMIT`,Jj=`${$j}_LABEL_ALIGN`,Qj=`${$j}_LABEL_TEXT`,tN=`${$j}_LABEL_VISIBLE`,eN=`${$j}_LABEL_X`,iN=`${$j}_LABEL_Y`,nN=`${$j}_ARC_RATIO`,sN=`${$j}_ARC_START_ANGLE`,rN=`${$j}_ARC_END_ANGLE`,aN=`${$j}_ARC_K`,oN=`${$j}_ARC_LABEL_HOVER_AX`,lN=`${$j}_ARC_LABEL_HOVER_AY`,hN=`${$j}_ARC_LABEL_POINT_AX`,cN=`${$j}_ARC_LABEL_POINT_AY`,dN=`${$j}_ARC_LABEL_POINT_BX`,uN=`${$j}_ARC_LABEL_POINT_BY`,pN=`${$j}_ARC_LABEL_POINT_CX`,gN=`${$j}_ARC_LABEL_POINT_CY`,fN=`${$j}_ARC_LABEL_SELECTED_AX`,mN=`${$j}_ARC_LABEL_SELECTED_AY`,yN=`${$j}_ARC_MIDDLE_ANGLE`,_N=`${$j}_ARC_QUADRANT`,vN=`${$j}_ARC_RADIAN`,bN=-Math.PI/2,xN=3*Math.PI/2,SN=-90,wN=270,AN=.6,kN={},MN=[],CN=(t,e,i)=>{kN[t]=Object.assign(e,{type:t}),i||MN.push(t)},TN=()=>{MN.slice().forEach((t=>{(t=>{delete kN[t];const e=MN.indexOf(t);e>=0&&MN.splice(e,1)})(t)}))};function EN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:f(t)?t:h(s=t)?null:s.fname})):null}function PN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function RN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const BN=":vGrammar_identifier:";function IN(t,e){return N(t).reduce(((t,i)=>{const n=f(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function DN(t,e){if(h(t))return[];if(!l(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(f(i))return N(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!l(t)&&!!(null==t?void 0:t.callback)}(t))return IN(t.dependency,e);var i;return[]}function LN(t){return l(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function ON(t,e,i,n){if(h(t))return t;if(l(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return f(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function FN(t,e){return zN(t)?t.output():e[t]}const zN=t=>t&&!h(t.grammarType),HN=t=>l(t)?t:e=>e[t],jN=t=>f(t)&&se.parseColorString(t)?t:null;function NN(t){return!!(null==t?void 0:t.scale)}function VN(t){return!!(null==t?void 0:t.field)}function WN(t,e){if(!t)return[];let i=[];return t.scale&&(i=zN(t.scale)?[t.scale]:N(e.getScaleById(t.scale))),i.concat(DN(t,e))}class UN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return f(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=N(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const GN={},YN=t=>GN[t],XN=(t,e,i,n,s)=>(GN[t]=new UN(e,i,n,s),GN[t]);function $N(t){return null===t?0:t}function KN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const qN=["fillOpacity","x","y","dx","dy"],ZN=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=$N(i.x),["x"]):"y"===e?(t.y=$N(i.y),["y"]):"dx"===e?(t.dx=$N(i.dx),["dx"]):"dy"===e?(t.dy=$N(i.dy),["dy"]):[]};var JN,QN,tV,eV,iV,nV,sV,rV,aV,oV,lV,hV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(JN||(JN={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(QN||(QN={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(tV||(tV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(eV||(eV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(iV||(iV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(nV||(nV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(sV||(sV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(rV||(rV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(aV||(aV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oV||(oV={})),function(t){t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd"}(lV||(lV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(hV||(hV={}));const cV={[QN.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),b(e.length)||!b(e.z1)&&b(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):b(e.z1)||!b(e.length)&&b(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[QN.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[QN.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return b(e)&&b(i)&&b(n)&&b(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[QN.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const dV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=f(t)?cV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(qN.includes(r)?ZN(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{qN.includes(t)?ZN(s,t,e):s[t]=e[t]}));return s},uV=(t,e,i)=>!(!h(t)||!h(e))||!h(t)&&!h(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(f(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function pV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case QN.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case QN.group:case QN.rect:case QN.image:return["width","height","y1"].includes(e);case QN.path:case QN.shape:return["path","customPath"].includes(e);case QN.line:return"defined"===e;case QN.area:return["x1","y1","defined"].includes(e);case QN.rule:return["x1","y1"].includes(e);case QN.symbol:return"size"===e;case QN.polygon:return"points"===e;case QN.text:return"text"===e}return!1}function gV(t,e,i,n,s){i&&(LN(i)?e.forEach((e=>{const s=ON(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],c=s&&!pV(t.mark.markType,r)?[e[0]]:e;if(NN(l)){const t=FN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!h(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=f(null==l?void 0:l.field),d=s?ol(l.field):null;let u=s?null:h(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=v(u)||v(i)?u+e+i:u}))}else if(VN(l)){const t=ol(l.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=ON(l,n,e.datum,t)}))})))}function fV(t,e,i,n){if(!t)return null;if(LN(t))return ON(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const c=t[r];if(NN(c)){const t=FN(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!h(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=f(null==c?void 0:c.field),p=u?ol(c.field):null,g=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):h(null==c?void 0:c.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,c.value);s[r]=v(g)||v(d)?g+i+d:g}else if(VN(c)){const t=ol(c.field);s[r]=t(e)}else s[r]=ON(c,n,e,i)})),s}function mV(t){if(t)return t.type===Ol.Band?t.bandwidth():t.type===Ol.Point?t.step():void 0}const yV={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=l(i)?i:ul(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!h(s)){if(h(t))return;t[s]=e}return e})),e;const r=n(e,i);return h(s)||h(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=Ve.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=ol(a),c=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),d=h(t.default)?null:t.default,u=s.map((t=>ol(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),h(n)&&(n=o);const t=o.map((t=>ol(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],l=o.length;return(h(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=h(r)?d:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=EN(i,t.as||[]),s=i.map((t=>f(t)?ol(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Y(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],x=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),w=b(S*_)?S/_:null,A=b(_*_)?_/x:null;return d&&(y[d]=x),p&&(y[p]=S),r&&(y[r]=w),a&&(y[a]=0===i?1:A),o&&(y[o]=!0===g?w:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:S/v[1]),c&&(y[c]=0===i?1:x/v[1]),u&&(y[u]=_),y}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=PN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=RN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return RN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;h(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=h(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=h(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{h(n[BN])&&(n[BN]=0);let s=n[BN];const r=t.as;return e.forEach((t=>{t&&h(t[r])&&(s+=1,t[r]=s)})),n[BN]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=mV(a.y),l="y"===t.dodgeChannel||h(t.dodgeChannel)&&o>0?"y":"x",c="y"===l?o:mV(a.x);if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!h(t.dodgeBy)){const e=sl(N(t.dodgeBy));o=t=>e(t.getDatum())}const d=[];e.forEach((t=>{const e=o(t);d.includes(e)||d.push(e)}));const u=d.length;if(u<1)return e;const p=fl(a,c);let g=p>=c?c:c-p;const f=fl(i,g);let m=(g-Math.max(u-1,0)*f)/u;m>t.maxWidth?(g-=(m-t.maxWidth)*u,m=t.maxWidth):m{y[t]=-g/2+e*(m+f)}));const _=r.markType;"rect"===_||"interval"===_?e.forEach((t=>{const e=o(t),i=y[e],n=t.getItemAttribute();if("x"===l){const e={x:(h(n.width)&&!h(n.x1)?Math.min(n.x,n.x1):n.x)+(h(n.width)?h(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};h(n.width)?e.x1=e.x+m:e.width=m,t.setItemAttributes(e)}else if("y"===l){const e={y:(h(n.height)&&!h(n.y1)?Math.min(n.y,n.y1):n.y)+(h(n.height)?h(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};h(n.height)?e.y1=e.y+m:e.height=m,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=y[e];if("x"===l){const e=t.getItemAttribute("x")+c/2;t.setItemAttributes({x:e+i+m/2})}else if("y"===l){const e=t.getItemAttribute("y")+c/2;t.setItemAttributes({y:e+i+m/2})}}))}return e},markPhase:"afterEncodeItems"}},_V="__vgrammar_scene_item__",vV=[QN.line,QN.area],bV=[QN.arc3d,QN.rect3d,QN.pyramid3d],xV="key",SV=[{}],wV=["key"],AV="VGRAMMAR_IMMEDIATE_ANIMATION",kV=0,MV=1e3,CV=0,TV=!1,EV=!1,PV="quintInOut",RV={stopWhenStateChange:!1,immediatelyApply:!0},BV={},IV=t=>BV[t],DV=(t,e)=>{BV[t]={creator:e}};class LV extends QT{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new uk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Bk.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new uk;let a,o;r.clear();const l=v(s)?s:Pt(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(lV.BEFORE_CREATE_VRENDER_MARK),e===QN.largeRects)return new LV(i);if(e===QN.largeSymbols)return new OV(i);const n=FV[e]?FV[e](i):IV(e)?IV(e).creator(i):null;return t.emit(lV.AFTER_CREATE_VRENDER_MARK),n}function HV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(lV.BEFORE_CREATE_VRENDER_MARK);const n=new ZP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=FV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(lV.AFTER_CREATE_VRENDER_MARK),n}const jV=t=>{t&&(t[_V]=null,t.release(),t.parent&&t.parent.removeChild(t))};class NV{constructor(t){this.data=null,this.states=[],this.diffState=JN.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if(l(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));gV(this,o,a,this.mark.parameters());const h=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[_V]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?dV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),h(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===JN.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(lV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=HN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(lV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=N(ON(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===JN.unChange&&(this.diffState=JN.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==JN.enter&&this.diffState!==JN.update||!this.states.length||this.useStates(this.states),this.mark.markType===QN.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new uk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===JN.enter?(r&&gV(this,t,r,i,o),s&&gV(this,t,s,i,o)):this.diffState===JN.update?(n&&r&&gV(this,t,r,i,o),s&&gV(this,t,s,i,o)):this.diffState===JN.exit&&a&&gV(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=o(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=N(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&f(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=N(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(lV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=o(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(lV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)gl(n,i,t)&&E(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let c=null==l?void 0:l.nextAttrs;if(t&&t.length&&h(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||KN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[QN.line,QN.area,QN.largeRects,QN.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===QN.line||e===QN.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>KN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=$N(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=$N(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=$N(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=$N(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===QN.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>uV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=dV(QN.line,t.attrs,i);return n.points=e.slice(t.startIndex,h(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?Object.assign(c,{segments:e,points:null}):Object.assign(c,{points:t,segments:null})}else p?Object.assign(c,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(c,{points:s,segments:null})}else e===QN.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=$N(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=$N(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=$N(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=$N(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===QN.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=$N(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=$N(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!M(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!h(e=C(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return C(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!E(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!E(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(jV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(jV(this.graphicItem),this.graphicItem[_V]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?h(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):h(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?m(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const VV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(b(e.center.x)&&(s.x=e.center.x),b(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},WV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),UV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const GV=["visible","path","text","lineWidth","textBaseline","textAlign"],YV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:c+u/2,width:h(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:d+p/2,height:h(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:c+u/2,x1:c+u/2,y:d+p/2,y1:d+p/2,width:h(o)?void 0:0,height:h(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:h(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:h(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:h(n)?void 0:0,height:h(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:h(n)?void 0:0}}:{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:h(n)?void 0:0}}:{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:VV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:VV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:WV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WV(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:UV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:UV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return GV.forEach((t=>{delete n[t],delete s[t]})),N(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{gl(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},XV=Object.assign({},YV),$V=t=>XV[t],KV=(t,e)=>{XV[t]=e},qV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.from.min=l,m.to.min=d),b(u)&&(m.from.max=l,m.to.max=u),b(p)&&(m.from.q1=l,m.to.q1=p),b(g)&&(m.from.q3=l,m.to.q3=g),b(f)&&(m.from.median=l,m.to.median=f),m},ZV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.to.min=l,m.from.min=d),b(u)&&(m.to.max=l,m.from.max=u),b(p)&&(m.to.q1=l,m.from.q1=p),b(g)&&(m.to.q3=l,m.from.q3=g),b(f)&&(m.to.median=l,m.from.median=g),m},JV=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(b(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return b(f)?f:b(_)&&b(v)?(_+v)/2:b(m)&&b(y)?(m+y)/2:b(y)?y:b(m)?m:NaN},QV=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),b(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(b(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),b(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const tW=(t,e,i)=>{var n,s,r,a;if(b(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return b(o)?o:b(c)&&b(d)?(c+d)/2:b(l)&&b(h)?(l+h)/2:b(h)?h:b(l)?l:NaN},eW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),b(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(b(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),b(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const iW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},nW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},sW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?nW:iW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},rW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},aW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},oW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function lW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(xV,i?t.slice().sort(i):t.slice()),{keys:wV,data:n};const s=HN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class hW{constructor(t,e,i){this.prevData=lW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const cW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=KN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=KN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const dW=(t,e,i,n,s)=>l(i)?i(t.getDatum(),t,s):i;class uW extends oC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class pW extends oC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{h(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:kA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:kA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}hC.mode|=CA.SET_ATTR_IMMEDIATELY;let gW=0;const fW=t=>!h(t)&&t.prototype instanceof oC;class mW{constructor(t,e,i){this.id=gW++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),b(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=l(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!$V(e.type))return null;const r=$V(e.type)(t,s,i);return cW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return m(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):d(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!h(null===(r=s[i])||void 0===r?void 0:r.from),l=!h(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?dW(t,0,s[i].from,0,n):void 0,e.to[i]=l?dW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),cW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),c=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=fW(o);return h(o)||fW(o)?u?new o(a.from,a.to,r,t.easing,c):a.to?new pW(a.from,a.to,r,t.easing):void 0:new uW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:c})})).filter((t=>!h(t)));1===e.length?t.play(e[0]):t.play(new LC(r,e))}}}function yW(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(_W(i,t[i]))})),e}function _W(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return N(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,c,d,u;if(h(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:kV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:EV,loop:null!==(n=l.loop)&&void 0!==n?n:TV,controlOptions:L({},RV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:MV,delay:null!==(a=l.delay)&&void 0!==a?a:CV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:PV,customParameters:l.customParameters,options:l.options}]}]}}const p=N(t.timeSlices).filter((t=>t.effects&&N(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:kV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:EV,loop:null!==(d=t.loop)&&void 0!==d?d:TV,controlOptions:L({},RV,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:CV,effects:N(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:PV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function vW(t,e,i){return l(t)?t.call(null,e.getDatum(),e,i):t}class bW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!h(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class xW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=yW(null!=e?e:{})}updateConfig(t){this.configs=yW(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==JN.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new bW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=_W(AV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new bW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return h(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=N(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===JN.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(h(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},o),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new mW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===JN.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(lV.ANIMATION_START,d),this.mark.emit(lV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=ON(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=vW(t.startTime,e,s),o=vW(t.totalTime,e,s),l=vW(t.oneByOne,e,s),h=vW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=vW(t.delay,e,s),l=null!==(i=vW(t.duration,e,s))&&void 0!==i?i:o/n,h=N(t.effects).map((t=>Object.assign({},t,{customParameters:vW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=v(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:v(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===JN.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===JN.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===AV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===JN.exit&&0===a[JN.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(lV.ANIMATION_END,h),this.mark.emit(lV.ELEMENT_ANIMATION_END,h,i)}}const SW=(t,e)=>zN(t)?t.output():t&&d(t)?l(t.callback)?i=>t.callback(i,e):l(t.value)?t.value(e):t:t,wW=(t,e)=>t?d(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=SW(s,e),i}),{}):t.map((t=>SW(t,e))):t;var AW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let kW=-1;class MW extends r{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++kW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=N(this.spec.dependency).map((t=>f(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=N(t).map((t=>f(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((i=>{var n;h(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return h(this.spec[e])||this.detach(DN(this.spec[e],this.view)),this.spec[e]=t,this.attach(DN(t,this.view)),this.commit(),this}}const CW=(t,e,i)=>{var n,s;if("callback"===t&&l(e))return{references:[],value:{callback:e,dependency:[]}};if(!h(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!h(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!h(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=DN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},TW=(t,e)=>{const i=(n=t.type,kN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(IN(a,e))));const o=((t,e,i)=>{if(h(e))return{value:e};if(m(e)){const n=e.map((e=>CW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return CW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},EW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=TW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class PW extends NV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if(l(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return gV(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[_V]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?dV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(lV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=o(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(lV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===JN.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==JN.enter&&this.diffState!==JN.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!h(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===JN.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=dV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{E(this.items[0].nextAttrs,e)||E(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=cV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{E(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===QN.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return vV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&E(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),E(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),E(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)gl(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[_V]=null})),this.glyphGraphicItems=null),super.release()}}const RW=t=>t.markType===QN.glyph?new PW(t):new NV(t);function BW(t){return h(t.offsetX)?h(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function IW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return b(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),b(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&b(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&b(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const DW="window",LW="view",OW={trap:!1},FW="default",zW="width",HW="height",jW="viewWidth",NW="viewHeight",VW="padding",WW="viewBox",UW="autoFit";function GW(t,e,i,n,s){if(s===DW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{IW(t,BW(t),!1)}))}));const e=BW(t);IW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var YW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class XW extends MW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new xW(this,{}),this.differ=new hW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=f(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=f(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!h(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===JN.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===oV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:SV,e);let n=i;i.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(lV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(lV.AFTER_MARK_JOIN),this.emit(lV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(lV.AFTER_MARK_STATE),this.emit(lV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(lV.AFTER_MARK_ENCODE)}return this.emit(lV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(lV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>h(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return YW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,h(t)||(f(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return f(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];LN(i)?this.detach(WN(i,this.view)):f(e)?this.detach(WN(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(WN(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return f(e)?(this.spec.encode[t][e]=i,this.attach(WN(i,this.view))):LN(e)?(this.spec.encode[t]=e,this.attach(WN(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(WN(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=EW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=EW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{h(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{h(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return vV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!h(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===JN.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];LN(s)||Object.keys(s).forEach((t=>{NN(s[t])&&(e[t]=FN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[_V];if((null==n?void 0:n.mark)===this){const i=GW(this.view,t,n,e,LW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new xW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=FN(this.spec.group,e);this.group=t,t&&(this.emit(lV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(lV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==QN.group){if(!this.graphicItem){const t=zV(this,QN.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||bV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==QN.group?(h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=HN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>xV),a=HN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>xV),o=this.spec.sort,l=this.spec.groupSort,c=this.isCollectionMark(),d=new Set(this.elements.filter((t=>t.diffState===JN.enter))),u=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(h(e))s=this.elementMap.get(n),s&&(s.diffState=JN.exit);else if(h(i)){s=this.elementMap.has(n)?this.elementMap.get(n):RW(this),s.diffState===JN.exit&&(s.diffState=JN.enter,this.animate.getElementAnimators(s,JN.exit).forEach((t=>t.stop("start")))),s.diffState=JN.enter;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),u.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=JN.update;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),u.push(s)}d.delete(s)}));const p=null!=t?t:SV;this.differ.setCurrentData(lW(p,c?a:t=>`${a(t)}-${r(t)}`,c?l:void 0)),this.differ.doDiff(),d.forEach((t=>{this.elementMap.delete(c?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=u,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(lV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(lV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:zV(this,this.markType,t);if(this.emit(lV.BEFORE_ADD_VRENDER_MARK),this.markType===QN.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(lV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==QN.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=lW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=HN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>xV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=RW(this);e.diffState=JN.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=RW(this);i.diffState=JN.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(LN(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===QN.glyph&&YN(i)){const t=YN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>pV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{pV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(lV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(lV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(pV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(lV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(lV.AFTER_MARK_JOIN),this.emit(lV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(lV.AFTER_MARK_STATE),this.emit(lV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(lV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(lV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(lV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||wV).forEach((t=>{const e=zV(this,QN.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(lV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(lV.AFTER_MARK_STATE),this.emit(lV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(lV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==JN.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return cV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=JN.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&jV(this.graphicItem),this.detachAll(),super.release()}}class $W extends XW{constructor(t,e,i){super(t,QN.component,i),this._componentDatum={[xV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:IV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,xV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[xV]+=1}evaluateJoin(t){return this.spec.key=xV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=f(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=f(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const KW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class qW extends QT{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){p(this.attribute[t])?L(this.attribute[t],e):this.attribute[t]=e,KW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>KW.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){h(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ct(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ct(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===pj.env?(pj.addEventListener("pointermove",this._onSliderPointerMove),pj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===pj.env?(pj.removeEventListener("pointermove",this._onSliderPointerMove),pj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=dt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:We(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=We(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new UM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function JW(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&JW(t,e)}))}ZW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const QW=t=>!h(t)&&!1!==t.visible,tU=["#ffffff","#000000"];function eU(t,e,i,n,s){const r=rU(t),a=rU(e);return iU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...tU);for(const s of r)if(t!==s&&iU(s,e,i,n))return s}(r,a,i,n,s)}function iU(t,e,i,n){return n?nU(t,e)>n:"largeText"===i?nU(t,e)>3:nU(t,e)>4.5}function nU(t,e){const i=sU(t),n=sU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function sU(t){const e=ae(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rU(t){if(null==t?void 0:t.includes("#"))return t;const e=new se(t),{r:i,g:n,b:s}=e.color;return"#"+oe(i,n,s)}function aU(t,e){return[t[0]*e,t[1]*e]}function oU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const lU=-.5*Math.PI,hU=1.5*Math.PI,cU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var dU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(dU||(dU={}));const uU={[dU.selectedReverse]:{},[dU.selected]:{},[dU.hover]:{},[dU.hoverReverse]:{}},pU=(t,e,i)=>new ze(Object.assign({defaultFontParams:{fontFamily:cU,fontSize:11},getTextBounds:i?void 0:yB,specialCharSet:"-/: .,@%'\"~"+ze.ALPHABET_CHAR_SET+ze.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gU(t,e){var i,n;if(!t)return{width:0,height:0};const s=yB({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var fU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sl&&(y=l,k.setAttribute("maxLineWidth",l-g[1]-g[2])));let D=0,L=0;"center"===B?(D-=y/2,m&&m.setAttribute("x",(m.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===B||"end"===B?(D-=y,m&&m.setAttribute("x",(m.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==B&&"start"!==B||f.setAttribute("x",g[3]),"middle"===I?(L-=_/2,m&&m.setAttribute("y",0)):"bottom"===I?(L-=_,m&&m.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===I&&(f.setAttribute("y",g[0]),m&&m.setAttribute("y",E/2));const{visible:O}=s,F=fU(s,["visible"]);if(u&&o(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:O&&!!e,x:D,y:L,width:y,height:_}),"rect");M(null==p?void 0:p.panel)||(t.states=p.panel)}}}mU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};class yU extends qW{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class _U extends yU{constructor(t){super(L({},_U.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}_U.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class vU extends yU{constructor(t){super(L({},vU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}vU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class bU extends yU{constructor(t){super(L({},bU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}bU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class xU extends yU{constructor(t){super(L({},xU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=lU,endAngle:n=hU}=this.attribute,s=n-i,r=Gt(Kt(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}xU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class SU extends yU{constructor(t){super(L({},SU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=$t(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}SU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const wU=new Uint32Array(33),AU=new Uint32Array(33);AU[0]=0,wU[0]=~AU[0];for(let t=1;t<=32;++t)AU[t]=AU[t-1]<<1|1,wU[t]=~AU[t];function kU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&wU[31&n]&AU[1+(31&s)])return!0}else{if(i[r]&wU[31&n])return!0;if(i[a]&AU[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,wU[31&i]&AU[1+(31&s)]);else for(n(r,wU[31&i]),n(a,AU[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,AU[31&i]|wU[1+(31&n)]);else for(s(r,AU[31&i]),s(a,wU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function MU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function CU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=MU(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function TU(t,e){return!(!t||!e)&&e.encloses(t)}function EU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return EU(t,e,s,h,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return EU(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}if("moveX"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return EU(t,e,s,r,null===(c=n.overlap)||void 0===c?void 0:c.clampForce)}return!1}const RU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],BU=["top","inside-top","inside"];const IU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function DU(t,e){var i,n;return null!==(n=null===(i=IU[e])||void 0===i?void 0:i.call(IU,t))&&void 0!==n?n:{from:{},to:{}}}const LU="same-time",OU=300,FU="linear";class zU extends qW{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||M(e.states)||(e.addState(dU.hover,!0),JW(this,(t=>{t===e||M(t.states)||t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(JW(this,(t=>{M(t.states)||(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void JW(this,(t=>{M(t.states)||(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));M(e.states)||(e.addState(dU.selected,!0),JW(this,(t=>{t===e||M(t.states)||t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!M(e)&&(t.states=e)}_createLabelText(t){const e=cB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if(l(s)&&(s=s({})),!s||0===s.length)return[];let r=[];l(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],h=this.getBaseMarkGroup(),c=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==h?void 0:h.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==h?void 0:h.AABBBounds.height())&&void 0!==s?s:0};if(0===c.width||0===c.height)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:p=!0,clampForce:g=!0}=e,f=this._bmpTool||kU(c.width,c.height),m=this._bitmap||f.bitmap(),y=u.some((t=>"bound"===t.type));d&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&m.setRange(MU(f,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:LU,h=null!==(n=a.duration)&&void 0!==n?n:OU,c=null!==(s=a.easing)&&void 0!==s?s:FU,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=DU(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&b(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new CC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(DU(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==kA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===kA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=eU(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=eU(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=eU(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class HU extends zU{constructor(t){super(L({},HU.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}HU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class jU extends zU{constructor(t){super(L({},jU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}jU.tag="rect-label",jU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const NU={rect:jU,symbol:HU};class VU extends qW{constructor(t){super(L({},VU.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!b(n*i))return;this._componentMap||(this._componentMap=new Map);const s=kU(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function WU(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function UU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=jt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function GU(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=WU(t,!!s),o=WU(r,!!s);const h=jt.distancePP(n,l),c=jt.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=UU(e,t,!1,!!s),o=UU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=WU(t,!!s),o=WU(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}VU.defaultAttributes={pickable:!1};class YU extends qW{constructor(t){super(L({},YU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!M(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let h="";if("line"===t||"polygon"===t)h=WU(o,!!n);else if("circle"===t){const{center:t}=this.attribute;h=UU(t,o,!1,!!n)}const c=oB(Object.assign({path:h,z:r},l(i)?L({},YU.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;o.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=WU(o,!!n),g=Ct(o[0].x-o[1].x),f=Ct(o[0].y-o[1].y),m=oB(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*wt/2:0,beta:gf?[o[0].x,0]:[0,o[0].y]},l(i)?L({},YU.defaultAttributes.style,i(t,e)):i));m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${s}`),this.add(m)})),e.length>1&&s)){const t=m(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0:i.size)||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};l=[...l.slice(0,l.length-1),n]}const h=aB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),M(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=dB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),M(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var $U,KU;XU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}($U||($U={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(KU||(KU={}));const qU={[KU.selectedReverse]:{},[KU.selected]:{},[KU.hover]:{},[KU.hoverReverse]:{}},ZU={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var JU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!M(e.states)&&(e.addState(dU.hover,!0),JW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(JW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(dU.selected))return this._lastSelect=null,void JW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));e.name&&!M(e.states)&&(e.addState(dU.selected,!0),JW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);L(this.attribute,t);const i=rB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=rB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,grid:r,items:a,panel:o}=this.attribute,l=rB({x:0,y:0,zIndex:1});if(l.name=$U.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=rB({x:0,y:0,pickable:!1});t.name=$U.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=lB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=$U.background,e.id=this._getNodeId("background"),M(o.state)||(e.states=L({},uU,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){var e;const i=this.getTickLineItems(),n=rB({x:0,y:0,pickable:!1});n.name=$U.tickContainer,n.id=this._getNodeId("tick-container"),t.add(n);const s=M(null===(e=this.attribute.tick)||void 0===e?void 0:e.state)?null:L({},uU,this.attribute.tick.state);i.forEach(((t,e)=>{const r=aB(Object.assign({},this._getTickLineAttribute("tick",t,e,i)));r.name=$U.tick,r.id=this._getNodeId(t.id),r.states=s,n.add(r)})),this.tickLineItems=i;const{subTick:r}=this.attribute;if(null==r?void 0:r.visible){const t=this.getSubTickLineItems();if(t.length){const e=M(r.state)?null:L({},uU,r.state);t.forEach(((t,s)=>{const r=aB(Object.assign({},this._getTickLineAttribute("subTick",t,s,i)));r.name=$U.subTick,r.id=this._getNodeId(`${s}`),r.states=e,n.add(r)}))}this.subTickLineItems=t}}renderLabels(t,e,i){var n;const{dataFilter:s}=this.attribute.label;s&&l(s)&&(e=s(e,i));const r=this._transformItems(e),a=rB({x:0,y:0,pickable:!1});a.name=`${$U.labelContainer}-layer-${i}`,a.id=this._getNodeId(`label-container-layer-${i}`),t.add(a);let o=0,h=0,c="center",d="middle";const u=M(null===(n=this.attribute.label)||void 0===n?void 0:n.state)?null:L({},uU,this.attribute.label.state);return r.forEach(((t,e)=>{var n;const s=this._getLabelAttribute(t,e,r,i),l=cB(s);l.name=$U.label,l.id=this._getNodeId(`layer${i}-label-${t.id}`),l.states=u,a.add(l);const p=null!==(n=s.angle)&&void 0!==n?n:0;o=Math.max(o,l.AABBBounds.width()),h=Math.max(h,l.AABBBounds.height()),p&&(o=Math.abs(o*Math.cos(p)),h=Math.abs(h*Math.sin(p))),c=s.textAlign,d=s.textBaseline})),this.axisLabelLayerSize[i]={width:o,height:h,textAlign:c,textBaseline:d},a}renderTitle(t){const e=this.getTitleAttribute(),i=new mU(Object.assign({},e));i.name=$U.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return rt(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&l(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;Ct(n[0])>Ct(n[1])?o=wt/2*(l.x>e.x?1:-1):h=wt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===_[1]?m+=(this.axisLabelLayerSize[n-1].height+C(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+C(this.attribute,"label.space",4))*n);const v=this.getVerticalCoord(t.point,m,p),b=this.getVerticalVector(m,p,v),x=g?g(t.label,t,e,i,n):t.label;let{style:S}=f;return S=l(S)?L({},ZU.label.style,S(t,e,i,n)):S,S=L({textAlign:this.getTextAlign(b),textBaseline:this.getTextBaseline(b,p)},S),l(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},v),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new YU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${$U.grid}-sub`:`${$U.grid}`,n.id=this._getNodeId(t),e.add(n)}}const tG={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&eG(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function eG(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function iG(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function sG(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Me(t,i),r=Me(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=ke(t),l=ke(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Ae(t.angle);let f=i?t.angle+At:Ae(90-t.angle);const m=i?e.angle:Ae(e.angle);let y=i?e.angle+At:Ae(90-e.angle);f>Mt&&(f-=Mt),y>Mt&&(y-=Mt);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Se(s,i)+Se(s,n))/2>Se(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function rG(t,e){"bottom"!==t&&"top"!==t||function(t,e){let i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var aG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return aU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:m}=l,y=aG(l,["position","space","textStyle","autoRotate","shape","background","state"]);let _=.5;"start"===c?_=0:"end"===c&&(_=1);const{verticalFactor:v=1}=this.attribute,b=-1*v,x=this.getTickCoord(_),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+C(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,T=this.getVerticalCoord(x,k,!1),E=this.getVerticalVector(k,!1);let P,R,{angle:B}=y;if(P="start"===c?"start":"end"===c?"end":"center",h(B)&&p){B=oU(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else P=this.getTextAlign(E),R=this.getTextBaseline(E,!1);const I=Object.assign(Object.assign(Object.assign({},T),y),{textStyle:Object.assign({textAlign:P,textBaseline:R},u),state:M(m)?null:{text:m.text,shape:m.shape,panel:m.background}});return I.angle=B,g&&g.visible&&(I.shape=Object.assign({visible:!0},g.style),g.space&&(I.space=g.space)),f&&f.visible&&(I.panel=Object.assign({visible:!0},f.style)),I}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=lU,endAngle:r=hU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}else{n=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(M(t))return;const{verticalLimitSize:o,label:c,title:d,line:u,tick:p,orient:g}=this.attribute,f=null!==(s=c.space)&&void 0!==s?s:4;let m=o,y=0,_=0;const v=(null==u?void 0:u.visible)?null!==(r=u.style.lineWidth)&&void 0!==r?r:1:0,x=(null==p?void 0:p.visible)?null!==(a=p.length)&&void 0!==a?a:4:0;(null==d?void 0:d.visible)&&(y=gU(d.text,d.textStyle).height,_=d.space),m&&(m=(m-f-_-y-v-x)/n);const{layoutFunc:S,autoRotate:w,autoRotateAngle:A,autoLimit:k,limitEllipsis:C,autoHide:T,autoHideMethod:E,autoHideSeparation:P}=c;l(S)?S(t,e,i,this):(w&&function(t,e){if(M(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Ut(e)})),rG(i,t),!sG(t))break}}(t,{labelRotateAngle:A,orient:g}),k&&b(m)&&m>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!M(t)&&b(i)&&t.forEach((t=>{const e=0===t.attribute.angle||h(t.attribute.angle)?"top"===s||"bottom"===s?null:i:i/Math.sin(t.attribute.angle);t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:m,ellipsis:C,orient:g}),T&&function(t,e){if(M(t))return;const i=t.filter(nG);if(M(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=l(s)?s:tG[s]||tG.parity;if(n.length>=3&&iG(n,r)){do{n=a(n,r)}while(n.length>=3&&iG(n,r));n.length<3&&!V(i).attribute.opacity&&(n.length>1&&V(n).setAttribute("opacity",0),V(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:g,method:E,separation:P}))}}oG.defaultAttributes=ZU;var lG,hG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=sB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=$U.line,c.id=this._getNodeId("line"),M(null==a?void 0:a.state)||(c.states=L({},qU,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=lU,endAngle:i=hU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=lU,endAngle:i=hU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return $t(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return aU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:m,state:y}=u,_=hG(u,["space","textStyle","shape","background","state"]);let v=l,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=C(this.attribute.label,"style.fontSize",12)+C(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;h(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",v={x:l.x,y:l.y-S}):"end"===A&&(w="top",v={x:l.x,y:l.y+S});const k=Object.assign(Object.assign(Object.assign({},v),_),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:M(y)?null:{text:y.text,shape:y.shape,panel:y.background}}),{angle:T}=_;return k.angle=T,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}cG.defaultAttributes=ZU;class dG extends oC{constructor(){super(...arguments),this.mode=CA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return JW(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},JW(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=b(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=_t.lastIndex=vt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=_t.exec(t))&&(n=vt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=vt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=lG.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=lG.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=lG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=lG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=lG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===lG.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===lG.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=lG.endHandler):this.state.start=this.state.start+o:this._activeTag===lG.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===pj.env&&(pj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),pj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===lG.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ct(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===lG.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ct(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===lG.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=pG(t,["formatMethod"]),{formatMethod:s}=e,r=pG(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:i,size:n,orient:s,middleHandlerStyle:r}=this.attribute,{width:a,height:o}=n,l=null!==(e=null===(t=null==r?void 0:r.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let h,c,d;return(null==r?void 0:r.visible)?this._isHorizontal?(h=a,c=o-l,d={x:i.x,y:i.y+l}):(h=a-l,c=o,d={x:i.x+("left"===s?l:0),y:i.y}):(h=a,c=o,d=i),this._layoutAttrFromConfig={position:d,width:h,height:c},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+P*I,y:B.y,width:(R-P)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+P*D,width:I,height:(R-P)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+P*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(P+R)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+P*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(P+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{position:i,size:n,selectedBackgroundChartStyle:s}=this.attribute,{width:r,height:a}=n,{start:o,end:l}=this.state;this.computeBasePoints(),this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?i.x+o*r:i.x,y:this._isHorizontal?i.y:i.y+o*a,width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?i.x+o*r:i.x),y:-(this._isHorizontal?i.y:i.y+o*a),width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==s?void 0:s.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==s?void 0:s.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new mU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;c(t)&&c(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...N(a))}setUpdateStateCallback(t){l(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){l(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){l(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){l(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){l(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){l(t)&&(this._statePointToData=t)}};var fG,mG,yG;gG.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!1,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(fG||(fG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(mG||(mG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(yG||(yG={}));class _G extends qW{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=rB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const vG={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:fG.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},bG={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},xG={label:{position:mG.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},SG={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},wG={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};let AG=class t extends _G{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},bG[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new XU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new mU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};AG.defaultAttributes=vG;let kG=class t extends _G{constructor(e){super(L({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},SG[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=pB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new mU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};kG.defaultAttributes=xG;let MG=class t extends _G{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=yG.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},wG[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=dB(Object.assign(Object.assign({},e),n)):"text"===i?o=new mU(Object.assign({},e)):"richText"===i?o=gB(Object.assign(Object.assign({},e),s)):"image"===i?o=uB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new XU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=aB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};MG.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const CG={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class TG extends qW{getCurrent(){return this._current}constructor(t){super(L({},TG.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new UM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new UM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(DG.item)){const t=i.delegate;t.hasState(BG.selected)?this._setLegendItemState(t,BG.selectedHover):this._setLegendItemState(t,BG.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===DG.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(IG.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(DG.item)){const t=i.delegate;t.removeState(BG.unSelectedHover),t.removeState(BG.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(BG.unSelectedHover),t.removeState(BG.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===DG.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(IG.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(DG.item)){const t=a.delegate;if(a.name===DG.focus){const e=t.hasState(BG.focus);t.toggleState(BG.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover,BG.focus]),this._setLegendItemState(t,BG.selected)})):(this._setLegendItemState(t,BG.selected),this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[BG.selected,BG.selectedHover,BG.focus]),this._setLegendItemState(e,BG.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(BG.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(BG.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(IG.legendItemClick,t);n?(this._removeLegendItemState(t,[BG.selected,BG.selectedHover]),this._setLegendItemState(t,BG.unSelected)):(this._setLegendItemState(t,BG.selected),this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover]))}else this._setLegendItemState(t,BG.selected),this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[BG.selected,BG.selectedHover]),this._setLegendItemState(e,BG.unSelected))}))}this._dispatchEvent(IG.legendItemClick,t)}}}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,BG.selected),this._removeLegendItemState(e,[BG.unSelected,BG.unSelectedHover])):(this._removeLegendItemState(e,[BG.selected,BG.selectedHover]),this._setLegendItemState(e,BG.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||M(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=rB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=EG,spaceRow:f=PG,maxWidth:m,width:y,height:_}=t;c(m)?c(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:c(y)&&(this._itemWidthByUser=y),c(_)&&(this._itemHeightByUser=_);let v=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!M(d)||(null==d?void 0:d.includes(t.label)),e),r=i.attribute.width,o=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,o),b=Math.max(r,b),this._itemMaxWidth=Math.max(r,this._itemMaxWidth),p?(w=s,c(l)&&(r>=l?(v=!0,e>0&&(x=0,S+=o+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+r):(w=n,c(h)&&h0&&i.setAttributes({x:x,y:S}),S+=f+o),a.add(i)}));let k=!1;v&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i){const{id:n,label:s,value:r,shape:a}=t,{shape:o={},label:l={},value:d={},padding:u=0,background:p,focus:g,focusIconStyle:f={}}=this.attribute.item,m=We(u);let y;!1===p.visible?(y=rB({x:0,y:0,cursor:null==p?void 0:p.style.cursor}),this._appendDataToShape(y,DG.item,t,y)):(y=rB(Object.assign({x:0,y:0},null==p?void 0:p.style)),this._appendDataToShape(y,DG.item,t,y,null==p?void 0:p.state)),y.addState(e?BG.selected:BG.unSelected);const _=rB({x:0,y:0,pickable:!1});y.add(_);let v=0;const b=C(o,"style.size",10),x=C(o,"space",8),S=dB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},a),o.style));let w;Object.keys(o.state||{}).forEach((t=>{const e=o.state[t].fill||o.state[t].stroke;a.fill&&h(o.state[t].fill)&&e&&(o.state[t].fill=e),a.stroke&&h(o.state[t].stroke)&&e&&(o.state[t].stroke=e)})),this._appendDataToShape(S,DG.itemShape,t,y,null==o?void 0:o.state),S.addState(e?BG.selected:BG.unSelected),_.add(S);let A=0;if(g){const e=C(f,"size",10);w=dB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},f),{visible:!1,pickMode:"imprecise",boundsPadding:m})),this._appendDataToShape(w,DG.focus,t,y),A=e}const k=cB(Object.assign(Object.assign({x:b/2+x,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==l?void 0:l.style.fontSize},null==l?void 0:l.style),{text:l.formatMethod?l.formatMethod(s,t,i):s}));this._appendDataToShape(k,DG.itemLabel,t,y,null==l?void 0:l.state),k.addState(e?BG.selected:BG.unSelected),_.add(k);const M=C(l,"space",8);if(v+=b/2+x+k.AABBBounds.width()+M,c(r)){const n=C(d,"space",g?8:0),s=cB(Object.assign(Object.assign({x:v+M,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==d?void 0:d.style.fontSize},null==d?void 0:d.style),{text:d.formatMethod?d.formatMethod(r,t,i):r}));this._appendDataToShape(s,DG.itemValue,t,y,null==d?void 0:d.state),s.addState(e?BG.selected:BG.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-b-x-k.AABBBounds.width()-M-A-n),d.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-b/2-m[1]-m[3]-A-n})),v=s.AABBBounds.x2+n,_.add(s)}else this._itemWidthByUser&&k.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-b-x-A);w&&(w.setAttribute("x",v),_.add(w));const T=_.AABBBounds,E=T.width(),P=T.height(),R=this._itemWidthByUser||E+m[1]+m[3],B=this._itemHeightByUser||P+m[0]+m[2];return y.attribute.width=R,y.attribute.height=B,_.translateTo(-T.x1+m[3],-T.y1+m[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=EG,spaceRow:h=PG}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=RG}=o,f=OG(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new TG(Object.assign({layout:1===r?"horizontal":"vertical",total:99},L({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new TG(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=rB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==DG.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==DG.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(BG.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=L({},FG,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new UM(t,{item:e,data:e.data,selected:e.hasState(BG.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}};var HG;function jG(t){return m(t)?t:[t,t]}function NG(t){return t?"ew-resize":"ns-resize"}zG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:EG,spaceRow:PG,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:RG,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(HG||(HG={}));let VG=class t extends qW{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(L({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===pj.env?(pj.addEventListener("pointermove",this._onHandlerPointerMove),pj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ct(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===pj.env)pj.removeEventListener("pointermove",this._onHandlerPointerMove),pj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===pj.env?(pj.addEventListener("pointermove",this._onTrackPointerMove),pj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ct(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ct(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===pj.env?(pj.removeEventListener("pointermove",this._onTrackPointerMove),pj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,d;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(c(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=N(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;h(u)&&(u=[o,l]),this._currentValue={startValue:jG(u)[0],endValue:jG(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=rB({x:0,y:0});g.name=HG.innerView,this.add(g),this._innerView=g;let f,m=0;if(r&&r.visible){f=cB(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=HG.startText,g.add(f);const e=c(r.space)?r.space:0;m+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const y=rB({x:p?m:0,y:p?0:m});g.add(y);const _=rB({x:0,y:0});let v;if(_.name=HG.railContainer,this._railContainer=_,y.add(_),this._renderRail(_),m+=p?n:s,a&&a.visible){const t=c(a.space)?a.space:0;v=cB(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),v.name=HG.endText,g.add(v)}this._renderTrack(_),d&&(this._renderHandlers(y),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=lB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=HG.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:c}=this.attribute;let{value:d}=this.attribute;h(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?l:o,[f,m]=jG(d),y=(f-i)/(n-i)*g,_=this._renderHandler(Object.assign({x:p?y:l/2,y:p?o/2:y,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":NG(p)},r));if(_.name=HG.startHandler,this._startHandler=_,t.add(_),this._currentValue.startPos=y,u){const e=this._renderHandlerText(f);e.name=HG.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(m-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":NG(p)},r));if(a.name=HG.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(m);e.name=HG.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:c}=this.attribute;h(c)&&(c=[i,n]);const u=this._isHorizontal,p=u?r:s;let[g,f]=jG(c);e||(g=i);const m=rB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=HG.trackContainer;const y=d(e)&&!0===e.draggableTrack;let _;_=!1===l?"default":!1===e||!1===y?"pointer":NG(u);const v=(f-g)/(n-i)*p,b=lB(Object.assign({x:u?(g-i)/(n-i)*p:0,y:u?0:(g-i)/(n-i)*p,width:u?v:r,height:u?s:v,cursor:_},a));b.name=HG.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return dB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":NG(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),cB(f)}_bindEvents(){const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),d(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===HG.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===HG.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===HG.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===HG.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new UM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};VG.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class WG extends LG{constructor(t){super(L({},WG.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function UG(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}WG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class GG extends LG{constructor(t){super(L({},GG.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y,sizeBackground:_}=this.attribute,v=rB({x:0,y:0});this._innerView.add(v);const b=new VG({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:UG(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=oB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}GG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};let YG=class t extends qW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,P,R,B,I,D,L,O,F,z,H,j,N,V,W,U,G,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:mt,minHeight:yt,maxHeight:_t,align:vt,verticalAlign:bt,padding:xt=0}=this.attribute,St=We(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&c(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else c(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(h=null==ct?void 0:ct.maxLineWidth)&&void 0!==h?h:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&c(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(m=ut.y)&&void 0!==m?m:At,width:null!==(_=null!==(y=ut.width)&&void 0!==y?y:pt)&&void 0!==_?_:0,height:null!==(b=null!==(v=ut.height)&&void 0!==v?v:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else c(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(c(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),c(gt)&&(Et=gt),c(ft)&&Ttmt&&(Tt=mt)),c(yt)&&Et_t&&(Et=_t)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],c(vt)||c(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:vt,e=null!==(O=null==ct?void 0:ct.width)&&void 0!==O?O:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","left")):"center"===t?(null===(H=this._mainTitle)||void 0===H||H.setAttribute("x",e/2),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(U=this._mainTitle)||void 0===U||U.setAttribute("textBaseline","top")):"middle"===t?(null===(G=this._mainTitle)||void 0===G||G.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(c(vt)||c(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:vt,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};YG.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const XG={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};let $G=class extends qW{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(c(i))if(!1!==i.visible){const t=L({},C(XG,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:c(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&b(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&b(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(c(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=N(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=L({},C(XG,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:c(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&b(a)&&this._setAutoFit(a,d,e),e.autoLimit&&b(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;h+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=gU(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",c(i.style.lineHeight)?i.style.lineHeight:s)}}};class KG extends UP{constructor(t){super(t)}}var qG,ZG;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(qG||(qG={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(ZG||(ZG={}));class JG extends qW{constructor(t){super(L({},JG.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},JG.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},JG.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},JG.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},JG.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{h(this._playController)&&(this._playController=new KG(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{h(this._backwardController)&&(this._backwardController=new KG(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{h(this._forwardController)&&(this._forwardController=new KG(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()}))},this._createCustomEvent=t=>{var e;const i=new UM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{const t=this._createCustomEvent(qG.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(qG.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(qG.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(qG.OnBackward);this.dispatchEvent(t)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}JG.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},JG.defaultAttributes={visible:!0,[ZG.Start]:{},[ZG.Pause]:{},[ZG.Backward]:{},[ZG.Forward]:{}};const QG={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},tY=[200,10];var eY,iY;!function(t){t.Default="default",t.Reverse="reverse"}(eY||(eY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(iY||(iY={}));const nY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===eY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===eY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},sY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===eY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===eY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},rY=t=>"top"===t||"bottom"===t;class aY extends qW{constructor(t){super(L({},aY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;b(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Pt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:b(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(rY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:tY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:tY[1];s.layout="vertical",s.railWidth=e,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new VG(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return rY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new JG(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=rY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:tY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=v(i)?i:Pt(i[0],i[1]);return t+e.space+n}),0),l=(rY(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:rY(this._orient)?t+n:(this._size.width-r)/2,y:rY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:rY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:rY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:rY(this._orient)?t+n:(this._size.width-r)/2,y:rY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){var i;const n=new UM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}aY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},QG),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},QG),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},QG),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},QG),{key:"backward",position:"start"})}};class oY extends aY{constructor(t){super(L({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:eY.Default,this._dataIndex=h(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(qG.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(qG.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(qG.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(qG.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(iY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(nY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||sY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===eY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(iY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(iY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(iY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),pj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(iY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,pj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(iY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(iY.OnChange),this.dispatchCustomEvent(iY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(iY.OnChange),this.dispatchCustomEvent(iY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var lY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class hY extends aY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(qG.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(qG.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(qG.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(qG.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,n=i/this._maxIndex;this._elapsed=n*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)}))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(iY.OnChange))},this.play=()=>lY(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(iY.OnPlay),this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,pj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(iY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,pj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(iY.OnPause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(iY.OnBackward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(iY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const cY={debounce:gt,throttle:ft};let dY=class t extends qW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",cY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(De(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=pB(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return L(t,...i,{shape:s.every(h)?void 0:L({},...s),key:r.every(h)?void 0:L({},...r),value:a.every(h)?void 0:L({},...a)})},pY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},gY={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:cU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Wt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},fY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let mY=class t extends qW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=We(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",L({symbolType:"circle"},d.shape,{visible:QW(d)&&QW(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:QW(d)&&QW(d.value)},pY(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:QW(d)&&QW(d.value)},d.value),"text");const u=QW(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-h[3]-h[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const m=QW(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+m);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!QW(l))return;const h=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let u=0;if(QW(l.shape)&&d.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),QW(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},pY(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(QW(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},pY(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";c(l.value.textAlign)?e=l.value.textAlign:QW(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>fY.includes(t)))?(this._mergeAttributes(e,n),h(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&QW(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=QW(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=pU(u),v=pU(p);let b=0;if(QW(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(QW(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&VP[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return uY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return uY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};mY.defaultAttributes=gY;const yY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class _Y extends $W{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=f(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}DV(iV.lineAxis,((t,e)=>new oG(t,e))),DV(iV.circleAxis,(t=>new cG(t)));class vY extends _Y{constructor(t,e,i){super(t,tV.axis,e),this.spec.componentType=tV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=L({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=IV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=fV(s,e,i,n);const c=ON(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=ON(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=ON(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case iV.lineAxis:return((t,e,i)=>{var n,s;const r=yY.axis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p);case iV.circleAxis:return((t,e,i)=>{var n,s;const r=yY.circleAxis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(h(e)){const i=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?iV.circleAxis:iV.lineAxis,this._axisComponentType}}DV(nV.discreteLegend,(t=>new zG(t))),DV(nV.colorLegend,(t=>new WG(t))),DV(nV.sizeLegend,(t=>new GG(t)));class bY extends _Y{constructor(t,e){super(t,tV.legend,e),this.spec.componentType=tV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==nV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":IG.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=f(t)?this.view.getDataById(t):t,l=f(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,eV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=IV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=fV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case nV.discreteLegend:return((t,e)=>{const i=yY.discreteLegend;return t?L({},i,{items:Array.from(new Set(N(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=jN(n),r=s?Object.assign(Object.assign({},yY.discreteLegend.items[0].shape),{fill:s,stroke:s}):yY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):L({},i,null!=e?e:{})})(o,a);case nV.colorLegend:return((t,e)=>{const i=yY.colorLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{colors:t.range().slice(),min:n[0],max:V(n)},null!=e?e:{})})(o,a);case nV.sizeLegend:return((t,e)=>{const i=yY.sizeLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&Fl(i)){const t=e.getScale().range();jN(null==t?void 0:t[0])?this._legendComponentType=nV.colorLegend:this._legendComponentType=nV.sizeLegend}else this._legendComponentType=nV.discreteLegend}return this._legendComponentType}}DV(sV.lineCrosshair,(t=>new _U(t))),DV(sV.rectCrosshair,(t=>new vU(t))),DV(sV.sectorCrosshair,(t=>new xU(t))),DV(sV.circleCrosshair,(t=>new bU(t))),DV(sV.polygonCrosshair,(t=>new SU(t)));const xY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(Hl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Yt(Kt(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else Fl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Kt(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class SY extends _Y{constructor(t,e){super(t,tV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case sV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=yY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return L({},l,xY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case sV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=yY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=xY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=L({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case sV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=yY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(Hl(e.type)){const i=Yt(Kt(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else Fl(e.type)&&(f=Kt(u,t));return L({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case sV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=yY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(Hl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else Fl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return L({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case sV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=yY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(Hl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else Fl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return L({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=tV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=IV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=fV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?sV.sectorCrosshair:sV.rectCrosshair:"radius"===n?sV.circleCrosshair:"radius-polygon"===n?sV.polygonCrosshair:sV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}DV(tV.slider,(t=>new VG(t)));class wY extends $W{constructor(t,e){super(t,tV.slider,e),this.spec.componentType=tV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=f(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=f(t)?this.view.getDataById(t):t,a=f(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,eV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>L({},yY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(h(this.spec.min)?0:ON(this.spec.min,i,t,e),h(this.spec.max)?1:ON(this.spec.max,i,t,e),fV(n,t,e,i))}),e}),{});this._encoders=e}}DV(tV.label,(t=>new VU(t)));let AY=class extends $W{constructor(t,e){super(t,tV.label,e),this.spec.componentType=tV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=ON(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=yY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case QN.line:r=yY.lineLabel;break;case QN.rect:r=yY.rectLabel;break;case QN.symbol:r=yY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[_V],n=fV(i,e.getDatum(),e,s),o=L({},r.data[0],n);a.push(o)}}));const o=ON(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return L({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!h(t)));return L({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};DV(tV.datazoom,(t=>new gG(t)));class kY extends $W{constructor(t,e){super(t,tV.datazoom,e),this.spec.componentType=tV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!h(this.spec.preview)){const t=this.spec.preview.data,e=f(t)?this.view.getDataById(t):t;this.detach(e),this.detach(WN(this.spec.preview.x,this.view)),this.detach(WN(this.spec.preview.y,this.view)),this.detach(WN(this.spec.preview.x1,this.view)),this.detach(WN(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=f(t)?this.view.getDataById(t):t;this.attach(r),this.attach(WN(e,this.view)),this.attach(WN(i,this.view)),this.attach(WN(n,this.view)),this.attach(WN(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t,c=f(e)?(t,i)=>{if(h(i.start)||h(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,eV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},yY.datazoom,t),n=IV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=f(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=fV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=yY.datazoom;return t?L({},l,{previewData:t,previewXCallback:e?t=>fV({x:e},t,r,a).x:null,previewYCallback:i?t=>fV({y:i},t,r,a).y:null,previewX1Callback:n?t=>fV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>fV({y1:s},t,r,a).y1:null},null!=o?o:{}):L({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=f(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}DV(aV.continuousPlayer,(t=>new hY(t))),DV(aV.discretePlayer,(t=>new oY(t)));let MY=class extends $W{constructor(t,e){super(t,tV.player,e),this.spec.componentType=tV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=m(t)?null:f(t)?this.view.getDataById(t):t;this.detach(e)}const r=m(e)?null:f(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=f(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(iY.OnChange,this._filterCallback),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t;return this._filterData(o,l,eV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(iY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=L({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:IV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=fV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=m(o)?null:f(o)?this.view.getDataById(o):o,h=m(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>L({},yY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>L({},yY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};DV(tV.tooltip,(t=>new mY(t)));let CY=class extends $W{constructor(t,e){super(t,tV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ft(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Wt).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>L({},yY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=tV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!h(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=fV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return N(t).reduce(((t,e)=>(t=t.concat(DN(e.visible,this.view)),VN(e.key)||(t=t.concat(DN(e.key,this.view))),VN(e.value)||(t=t.concat(DN(e.value,this.view))),VN(e.symbol)||(t=t.concat(DN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=ON(t.visible,n,e,i);return o=!!h(o)||!!o,s=VN(t.key)?ol(t.key.field)(e):ON(t.key,n,e,i),s=h(s)?void 0:u(s)?s:{text:s},r=VN(t.value)?ol(t.value.field)(e):ON(t.value,n,e,i),r=h(r)?void 0:u(r)?r:{text:r},a=VN(t.symbol)?ol(t.symbol.field)(e):ON(t.symbol,n,e,i),a=h(a)?void 0:u(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?N(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var TY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class EY extends MW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],h(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=DN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];N(t.source).forEach((t=>{const i=zN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return TY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return h(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return h(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=N(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=EW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=EW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(N(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=N(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function PY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function RY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,PY(t,e,s,n)}class BY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return PY(this.nodes,e,0,this.compare),RY(this.nodes,e,null,this.compare)}return this.nodes.push(t),PY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),PY(this.nodes,e,0,this.compare),RY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,RY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class IY{constructor(t){this.list=[],this.ids={},this.idFunc=t||ll}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var DY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class LY{constructor(){this.grammars=[],this.logger=Ve.getInstance(),this._curRank=0,this._committed=new IY((t=>t.uid)),this._heap=new BY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return DY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>h(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new IY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return DY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const OY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===QN.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class FY{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(lV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return PT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Wk.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(lV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Mj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(lV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(lV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(lV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new ZM(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=d(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new tC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class zY extends MW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?ON(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(m(t)&&m(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function $Y(t,e,i){ON(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=ON(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),h(null==n?void 0:n.clamp)||(l(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function KY(t,e,i){GY(t,e,i),YY(t,e,i),XY(t,e,i),$Y(t,e,i)}function qY(t,e,i){t.round&&e.round(ON(t.round,i,e),!0),t.padding&&e.padding(ON(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(ON(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(ON(t.paddingOuter,i,e),!0),t.align&&e.align(ON(t.align,i,e),!0)}function ZY(t,e,i,n){const s=t.field,r=FN(t.data,i),a=f(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),Fl(e.type)?(n&&a.filter((t=>v(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function JY(t,e,i){if(jY(t.domain)?e.domain(ZY(t.domain,e,i,!0),!0):e.domain(ON(t.domain,i,e),!0),jY(t.range))e.range(ZY(t.range,e,i),!0);else if(NY(t.range)){const n=FN(t.range.coordinate,i);!function(t){switch(t){case Ol.Quantile:case Ol.Quantize:case Ol.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(ON(t.range,i,e),!0);switch(t.type){case"linear":KY(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){qY(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){KY(t,e,i);const n=ON(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){GY(t,e,i),XY(t,e,i),$Y(t,e,i);const n=ON(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){KY(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){KY(t,e,i);const n=ON(t.constant,i,e);b(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){GY(t,e,i),XY(t,e,i),$Y(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){GY(t,e,i),YY(t,e,i),XY(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class QY extends MW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=HY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=HY(this.spec.type)),JY(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return h(this.spec.domain)||this.detach(WY(this.spec.domain,this.view)),this.spec.domain=t,this.attach(WY(t,this.view)),this.commit(),this}range(t){return h(this.spec.range)||this.detach(WY(this.spec.range,this.view)),this.spec.range=t,this.attach(WY(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!h(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!h(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return h(e)?null:this.parameters()[e]}configure(t){return this.detach(UY(this.spec.type,t,this.view)),h(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(UY(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let tX=-1;const eX=[zW,HW,VW,jW,NW,WW,UW],iX=t=>{var e,i,n,s;return v(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},nX=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:PV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:CV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:MV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:EV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},sX=(t,e)=>(null==e?void 0:e.debounce)?gt(t,e.debounce):(null==e?void 0:e.throttle)?ft(t,e.throttle):t,rX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:LW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):FV[t]?(i.markType=t,i.source=e):i.source=t===DW?DW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},aX={},oX=()=>aX;let lX=class extends XW{constructor(t,e){super(t,QN.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return cV.rect}evaluateJoin(t){return super.evaluateJoin(SV)}};function hX(t,e){if(b(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return b(t)?t*e:0}return 0}function cX(t,e){return Math.min(t<0?t+e:t-1,e)}function dX(t,e,i){let n=cX(t,i),s=cX(e,i);if(b(t)||b(e)?b(t)?b(e)||(n=cX(Math.max(0,s-1),i)):s=cX(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const uX=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>hX(t,i))),u=l.map((t=>hX(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=dX(e,i,r),{start:h,end:c}=dX(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},pX=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=fl(r.maxChildWidth,s.width()),o=fl(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=iX(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==QN.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(l(r))r.call(null,t,s,a,e);else if(l(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=pX(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(jW,o),i.updateSignal(NW,l),i.updateSignal(VW,h)}else pX(t,s,a,e);else"grid"===r.display&&uX(t,s,a);gX(s,e,i)}))};class fX extends XW{constructor(t,e,i){super(t,QN.glyph,i),this.glyphType=e,this.glyphMeta=YN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=HV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let mX=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return h(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return h(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return m(t)?(i.x=t[0],i.y=t[1]):v(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new qt,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class yX extends mX{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=h(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=h(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=m(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class _X extends mX{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Yt(s);const r=rt(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function vX(t){switch(t){case"cartesian":default:return new yX;case"polar":return new _X}}class bX extends MW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=vX(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=vX(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,c;!h(t.start)&&e.start(null!==(n=ON(t.start,i))&&void 0!==n?n:[0,0]),!h(t.end)&&e.end(null!==(s=ON(t.end,i))&&void 0!==s?s:[0,0]),!h(t.origin)&&e.origin(null!==(r=ON(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!h(t.translate)){const e=ON(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!h(t.rotate)){const e=ON(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!h(t.scale)){const e=ON(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}h(t.transpose)||ON(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const xX=Symbol.for("key");class SX{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new hW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i[0]}):h(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(lW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==QN.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==QN.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=lW(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=lW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!h(e.morphElementKey)){const i=HN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new hW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i}):h(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(lW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:xX})),r=lW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:xX}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==xX){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=ON(i.animation.delay,s,o,l),d=ON(i.animation.duration,s,o,l),u=ON(i.animation.oneByOne,s,o,l),p=ON(i.animation.splitPath,s,o,l),g=b(u)&&u>0?t=>v(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?bT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xT)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);mT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?bT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>uT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>gT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:kA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new fT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:gC,null!==(l=i.easing)&&void 0!==l?l:fC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:kA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new yT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:gC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:fC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):mT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class wX{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=f(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),h(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),h(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),h(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),h(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class AX{constructor(t){this.view=t}stop(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.stop()})),this}pause(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.pause()})),this}resume(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.resume()})),this}enable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.enable()})),this}disable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.disable()})),this}enableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.enableAnimationState(t)})),this}disableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.disableAnimationState(t)})),this}animate(){return this.view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){}}class kX extends XW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=LN(e)?null:Object.keys(e).reduce(((t,n)=>(NN(e[n])&&(t[n]=FN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=fV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===Ol.Band){if(!h(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===Ol.Band){if(!h(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:cV.rect}addGraphicItem(t,e){const i=zV(this,this.coord&&"polar"===this.coord.output().type?QN.arc:QN.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class MX extends XW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=LN(e)?null:Object.keys(e).reduce(((t,n)=>(NN(e[n])&&(t[n]=FN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=fV(e,t,i,s);if(h(r.size)){const t=n.x?mV(n.x):void 0,e=n.y?mV(n.y):void 0;h(t)&&h(e)?r.size=10:h(t)?r.size=e:h(e)&&(r.size=t),r.size=[t,e]}return h(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(v(i.padding)&&i.padding>0)t.size=m(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(m(i.padding)&&2===i.padding.length){const e=m(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(cV.symbol)}release(){super.release(),this._encoders=null}}var CX=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class TX extends r{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[_V],s=GW(0,t,n,e,LW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){f(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new zY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new EY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new QY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new bX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=f(e)?this.getMarkById(e):e;let s;switch(t){case QN.group:s=new lX(this,n);break;case QN.glyph:s=new fX(this,null==i?void 0:i.glyphType,n);break;case QN.component:s=((t,e,i,n)=>{switch(e){case tV.axis:return new vY(t,i,n);case tV.legend:return new bY(t,i);case tV.crosshair:return new SY(t,i);case tV.slider:return new wY(t,i);case tV.label:return new AY(t,i);case tV.datazoom:return new kY(t,i);case tV.player:return new MY(t,i);case tV.tooltip:return new CY(t,i)}return new $W(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case QN.interval:s=new kX(this,t,n);break;case QN.cell:s=new MX(this,t,n);break;default:s=new XW(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(QN.group,t)}glyph(t,e){return this.mark(QN.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(QN.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(QN.component,t,{componentType:tV.axis,mode:e})}legend(t){return this.mark(QN.component,t,{componentType:tV.legend})}crosshair(t){return this.mark(QN.component,t,{componentType:tV.crosshair})}slider(t){return this.mark(QN.component,t,{componentType:tV.slider})}label(t){return this.mark(QN.component,t,{componentType:tV.label})}datazoom(t){return this.mark(QN.component,t,{componentType:tV.datazoom})}player(t){return this.mark(QN.component,t,{componentType:tV.player})}tooltip(t){return this.mark(QN.component,t,{componentType:tV.tooltip})}customized(t,e){const i=(t=>aX[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=f(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&eX.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(lV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++tX;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(zW,t.width),this.updateSignal(HW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=oX();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(lV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=oV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:zW,value:null!==(i=t[zW])&&void 0!==i?i:0},{id:HW,value:null!==(n=t[HW])&&void 0!==n?n:0},{id:VW,value:iX(null!==(s=t[VW])&&void 0!==s?s:e[VW])},{id:jW,update:{callback:(t,e)=>{const i=iX(e[VW]);return e[zW]-i.left-i.right},dependency:[zW,VW]}},{id:NW,update:{callback:(t,e)=>{const i=iX(e[VW]);return e[HW]-i.top-i.bottom},dependency:[HW,VW]}},{id:WW,update:{callback:(t,e)=>{const i=iX(e[VW]);return(t||new Vt).setValue(i.left,i.top,i.left+e[jW],i.top+e[NW])},dependency:[jW,NW,VW]}},{id:UW,value:null!==(r=t[UW])&&void 0!==r?r:e[UW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===QN.glyph?{glyphType:t.glyphType}:t.type===QN.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(zW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(HW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(jW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(NW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(VW);if(arguments.length){const i=iX(t);return this.updateSignal(e,i),i}return iX(e.output())}autoFit(t){const e=this.getSignalById(UW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(WW);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=oV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===QN.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||gX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(lV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(lV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(lV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{OY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(lV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(lV.BEFORE_MARK_RENDER_END),OY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(lV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return CX(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return CX(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(lV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(lV.AFTER_DO_RENDER)}evaluate(t){var e,i;return CX(this,void 0,void 0,(function*(){const n=nX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=oV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=oV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=oV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=nX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=oV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=oV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=oV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!eX.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return OY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=tn(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return CX(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(zW,t)),e!==this.height()&&(n=!0,this.updateSignal(HW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,c=rX(e);if(!c)return;const{source:u,type:p}=c,g=h((v=c).markId)?t=>t&&t.mark.id()===v.markId:h(v.markName)?t=>t&&t.mark.name()===v.markName:h(v.type)?t=>t&&t.mark.markType===v.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:f(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),y=IN(l,this),_=sX(((t,e)=>{const n=u===LW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===DW&&(t=GW(0,t,e,p,DW));let s=!1;if((!i||i(t))&&(!g||g(e))&&m.length){const e=y.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var v;if(u===LW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||d(n)&&!n[i])}(this._eventConfig,LW,p))return this.addEventListener(p,_,OW),()=>{this.removeEventListener(p,_)}}else if(u===DW)return pj.addEventListener(p,_),this._eventListeners.push({type:p,source:pj,handler:_}),()=>{pj.removeEventListener(p,_);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===pj&&t.handler===_));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);f(e)?i.type=e:d(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:FW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?f(r)?r:r.user:FW,o=r&&a===r.user&&(s===r.element||h(s)&&h(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==FW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!h(document)&&document.body:this.container;return e?h(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new FY(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new wX((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new wX((t=>t.id())),this._options.logger&&Ve.setInstance(this._options.logger),this.logger=Ve.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new LY,this.animate=new AX(this),this._morph=new SX,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{m(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[LW,DW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&pj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=oV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==QN.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=pj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&pj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),TN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const EX=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{CN(e,t[e],!0)}))}))};EX(yV);const PX=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var RX,BX,IX;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(RX||(RX={})),function(t){t.chart="chart",t.window="window"}(BX||(BX={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(IX||(IX={}));const DX=`${$j}_waterfall_default_seriesField`,LX=`${$j}_DEFAULT_DATA_INDEX`,OX=`${$j}_DEFAULT_DATA_KEY`,FX=`${$j}_DEFAULT_DATA_SERIES_FIELD`,zX=`${$j}_DEFAULT_SERIES_STYLE_NAME`;var HX;!function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.Built_In=99]="Built_In"}(HX||(HX={}));const jX=`${$j}_STACK_START`,NX=`${$j}_STACK_END`,VX=`${$j}_STACK_START_PERCENT`,WX=`${$j}_STACK_END_PERCENT`,UX=`${$j}_STACK_START_OffsetSilhouette`,GX=`${$j}_STACK_END_OffsetSilhouette`,YX=`${$j}_SEGMENT_START`,XX=`${$j}_SEGMENT_END`;var $X,KX;!function(t){t[t.Axis_Grid=100]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark"}($X||($X={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(KX||(KX={}));const qX=["linear","radial","conical"],ZX={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},JX={innerRadius:0,outerRadius:1,startAngle:SN,endAngle:wN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var QX,t$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(QX||(QX={})),function(t){t.middle="middle",t.start="start",t.end="end"}(t$||(t$={}));const e$={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,tickSize:Bj,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Bj/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Pj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Pj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},i$={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},n$={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},s$={name:"light",padding:12,fontFamily:Ej,colorScheme:{default:{dataScheme:[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Pj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Pj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Gj,line:jj,area:Ij,bar:Dj,bar3d:Lj,pie:Vj,pie3d:Wj,map:Nj,radar:Uj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:Oj,funnel3d:Fj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:Yj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:Hj,treemap:Xj,sunburst:JX,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Pj},minLabel:{position:t$.end},maxLabel:{position:t$.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Pj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Pj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...n$,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...n$,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...n$},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...n$}},axis:e$,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10},maxHeight:"30%"},axisY:{label:{space:20},title:{space:20,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Pj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Pj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!1,background:{size:5,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:8,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:i$,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Rj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Pj,lineHeight:Rj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Pj,fontFamily:Ej}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Pj,fontFamily:Ej}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}}}},r$=new Map([[s$.name,s$]]),a$=s$.name;class o${static instances=new Map;static registerInstance(t){o$.instances.set(t.id,t)}static unregisterInstance(t){o$.instances.delete(t.id)}static getInstance(t){return o$.instances.get(t)}static instanceExist(t){return o$.instances.has(t)}static forEach(t,e=[],i){const n=N(e);return o$.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class l${static themes=new Map;static _currentThemeName=a$;static registerTheme(t,e){t&&l$.themes.set(t,L({},l$.getDefaultTheme(),e))}static getTheme(t){return l$.themes.get(t)||l$.getDefaultTheme()}static removeTheme(t){return l$.themes.delete(t)}static themeExist(t){return l$.themes.has(t)}static getDefaultTheme(){return l$.themes.get(a$)}static setCurrentTheme(t){l$.themeExist(t)&&(l$._currentThemeName=t,o$.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return l$.getTheme(l$._currentThemeName)}static getCurrentThemeName(){return l$._currentThemeName}}l$.registerTheme(a$,r$.get(a$)),r$.forEach(((t,e)=>{e!==a$&&l$.registerTheme(e,t)}));const h$=(t,e,i)=>new ze({defaultFontParams:{fontFamily:Tj,fontSize:14},getTextBounds:i?void 0:yB,specialCharSet:"-/: .,@%'\"~"+ze.ALPHABET_CHAR_SET+ze.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),c$=gB({});function d$(t,e){for(let i=0;it.key===e))}function p$(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const g$=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;s{M(t.state[e])||(t.state[e]=_$(t.state[e]))})),t}function y$(t){return M(t)?null:(Object.keys(t).forEach((e=>{M(t[e])||(t[e]=_$(t[e]))})),t)}function _$(t){return M(t)||t.angle&&(t.angle=Ut(t.angle)),t}var v$;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(v$||(v$={}));class b${static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Ja,fields:eo,filter:un,fold:to};static dataParser={csv:go,dsv:po,tsv:fo};static _layout={};static registerChart(t,e){b$._charts[t]=e}static registerSeries(t,e){b$._series[t]=e}static registerComponent(t,e){b$._components[t]=e}static registerMark(t,e){b$._marks[t]=e}static registerRegion(t,e){b$._regions[t]=e}static registerTransform(t,e){b$.transforms[t]=e}static registerLayout(t,e){b$._layout[t]=e}static createChart(t,e,i){if(!b$._charts[t])return null;return new(0,b$._charts[t])(e,i)}static createRegion(t,e,i){if(!b$._regions[t])return null;return new(0,b$._regions[t])(e,i)}static createSeries(t,e,i){if(!b$._series[t])return null;return new(0,b$._series[t])(e,i)}static createMark(t,e,i){if(!b$._marks[t])return null;const n=new(0,b$._marks[t])(e,i);return n.type===v$.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(b$._components)}static getComponentInKey(t){return b$._components[t]}static getLayout(t){return b$._layout[t]}static getSeries(t){return b$._series[t]}}const x$=(t,e,i)=>{const n=t.getRegionsInIds(N(e.layoutBindRegionID));return n?.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},S$=(t,e)=>t===e||!h(t)&&!h(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),w$=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},A$="monotone",k$="linearClosed";var M$;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(M$||(M$={}));var C$;function T$(t){return"bottom"===t||"top"===t}function E$(t){return"left"===t||"right"===t}function P$(t){return"z"===t}function R$(t,e){return Uh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(C$||(C$={}));const B$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&x$(t,n,i)));return n.length?n:null},I$=t=>t.fieldX[0],D$=t=>t.fieldY[0],L$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=O$(t,n,"x",I$);e&&o.push(e)})),a&&a.forEach((t=>{const e=O$(t,s,"y",D$);e&&o.push(e)})),o.length?o:null},O$=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return F$(t,a,n)},F$=(t,e,i)=>{const n=t.getScale();if(!n||!Hl(n.type))return null;if(h(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=w$(e,t,"cartesian",i??(T$(t.orient)?I$:D$));return{index:s,value:e,axis:t,data:r}},z$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&x$(t,n,i)));return n.length?n:null},H$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&Hl(e.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=Bl({x:1,y:0},d);u=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(u,r);const p=Il(d),g=a[0]?.getScale(),f=g?.range();if((u-r?.[0])*(u-r?.[1])>0||(p-f?.[0])*(p-f?.[1])>0)return;const m=Math.abs(r[0]-r[1])/i.length/2,y=e.invert(u+m);if(h(y))return;let _=e.domain().findIndex((t=>t?.toString()===y.toString()));_<0&&(_=void 0);const v=w$(y,t,"polar",l);o.push({index:_,value:y,axis:t,data:v})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&Hl(e.type)){const a=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let d=Bl({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const u=Il(c),p=r[0]?.getScale(),g=p?.range();if((d-g?.[0])*(d-g?.[1])>0||(u-i?.[0])*(u-i?.[1])>0)return;const f=e.invert(u);if(h(f))return;let m=e.domain().findIndex((t=>t?.toString()===f.toString()));m<0&&(m=void 0);const y=w$(f,t,"polar",l);o.push({index:m,value:f,axis:t,data:y})}})),o.length?o:null};class j${_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=L$(this._chart,{x:t,y:e})??[],n=H$(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!Hl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=F$(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var N$;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(N$||(N$={}));const V$={[N$.dimensionHover]:class extends j${_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:BX.chart},callback:this.onMouseMove}),Zo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:BX.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Zo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!S$(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[N$.dimensionClick]:class extends j${constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:BX.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let W$=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(V$[t]){const e=new V$[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(V$[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class U${_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(IX.vchart,[]),this._levelNodes.set(IX.chart,[]),this._levelNodes.set(IX.model,[]),this._levelNodes.set(IX.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const G$={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class Y${globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||BX.chart),n=this.getEventListeners(e.filter?.source||BX.chart);i.get(t)||i.set(t,new U$);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||BX.chart),s=this.getEventListeners(e?.filter?.source||BX.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||BX.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||BX.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(IX.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(IX.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(IX.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(IX.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(BX.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(BX.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if(l(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&C(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return G$[n]&&(n=G$[n]),(!t.type||n===t.type)&&(!c(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=c(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=c(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&c(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();c(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:C(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:c(t.id)?IX.model:IX.vchart:IX.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ft(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=gt(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=BX.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==IX.model&&i!==IX.mark||(n=e.type),e?.source&&(s=e.source),c(e?.id)&&(o=e?.id,i=IX.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case BX.chart:return this._viewBubbles;case BX.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case BX.chart:return this._viewListeners;case BX.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return PX.includes(t)||Object.values(lV).includes(t)||Object.values(RX).includes(t)}}function X$(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function $$(t,e,i){t.getParser(e)||t.registerParser(e,i)}const K$=new Map;let q$;function Z$(t,e,i={type:"geojson",centroid:!0}){K$.has(t)&&Go(`map type of '${t}' already exists, will be overwritten.`),q$||(q$=new Ho,$$(q$,"geojson",Io),$$(q$,"topojson",Lo),X$(q$,"simplify",Ja));const n=new No(q$),s=L({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),K$.set(t,n)}function J$(t,e=!1){let i=e;return t.latestData instanceof No&&(i=!1),i?R(t.latestData):t.latestData.slice()}const Q$=(t,e)=>0===t.length?[]:1===t.length?J$(t[0],e?.deep):t.map((t=>J$(t,e?.deep)));function tK(t,e,i){X$(e=e instanceof Ho?e:t.dataSet,"copyDataView",Q$);const n=new No(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function eK(t,e,i=[]){if(t instanceof No)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new No(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!f(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Yo("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const iK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)}}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!f(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&pj.getCancelAnimationFrame()(this._rafId),this._rafId=pj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===BX.chart){const n=function(n,s){const r=s?.mark?.context??{},a=c(r.modelId)?r.modelId:null,o=c(r.markId)?r.markId:null,l=c(r.modelUserId)?r.modelUserId:null,h=c(r.markUserId)?r.markUserId:null,d={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,d)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===BX.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===BX.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===BX.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(h(e))return;const i=e.id(),n=t.grammarType;h(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(h(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];c(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return c(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return qo(this._option.mode)?globalThis:this.getStage()?.window}}async function cK(t){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){console.error("getCanvasDataURL",t)}return t.toDataURL()}class dK{id=tl();static useChart(t){t.forEach((t=>b$.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>b$.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>b$.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>b$.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>b$.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){b$.registerTransform(t,e)}static registerMap(t,e,i){Z$(t,e,i)}static unregisterMap(t){!function(t){K$.has(t)?K$.delete(t):Go(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,K$.get(e);var e}static hideTooltip(t=[]){o$.forEach((t=>t?.hideTooltip?.()),t)}static InstanceManager=o$;static ThemeManager=l$;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=L(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,...a}=this._option;i&&(this._container=f(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=l$.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new hK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,...a,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new Y$(this,this._compiler),this._event=new W$(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!qo(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(RX.initialized,{}),o$.registerInstance(this)):Yo("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=Zh(f(t)?JSON.parse(t):t))}_initData(){if(h(this._dataSet))return void Go("dataSet is not initialized");const t=N(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Yo("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=gt(((...t)=>{const{width:e,height:i}=tn(this._container,Kj,qj),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof Ho?t:new Ho,$$(this._dataSet,"dataview",Oo),$$(this._dataSet,"array",hn),X$(this._dataSet,"stackSplit",iK),X$(this._dataSet,"copyDataView",Q$);for(const t in b$.transforms)X$(this._dataSet,t,b$.transforms[t]);for(const t in b$.dataParser)$$(this._dataSet,t,b$.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return c(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)}))),this._event.emit(RX.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)}))),this._event.emit(RX.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),K$.clear(),q$=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,o$.unregisterInstance(this)}async updateData(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):m(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new No(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new No(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(f(t)&&(t=JSON.parse(t)),e&&(t=L({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=Zh(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}_updateCurrentTheme(){f(this._spec?.theme)?(this._currentTheme=L({},l$.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=L({},l$.getTheme(this._currentThemeName),this._spec?.theme??{})}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return l$.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===dn.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(c(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===dn.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===dn.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===dn.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await cK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!qo(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(c(this._container))return this._container;let t;return t=f(this._canvas)?document?.getElementById(this._canvas):this._canvas,c(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(M(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),qh(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||h(t)||M(e))return null;if(!m(t)){const{axisId:n,axisIndex:s}=e;let r;if(c(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):c(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Go("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?qh(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Go("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(rK||(rK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aK||(aK={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(oK||(oK={}));class uK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){h(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,L({},uK.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return[...this._children]}getMarksInType(t){const e=N(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}class pK{event;interaction;_option;_marks=new uK;_markReverse=new uK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){M(t.stateStyle[rK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),M(t.stateStyle[rK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(N$.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=m(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(rK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(rK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(rK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(rK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(rK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class gK{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class fK extends gK{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=KX.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=$h(Kh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=h(t.minHeight)?null:Xh(t.minHeight,e.height,e),this._maxHeight=h(t.maxHeight)?null:Xh(t.maxHeight,e.height,e),this._minWidth=h(t.minWidth)?null:Xh(t.minWidth,e.width,e),this._maxWidth=h(t.maxWidth)?null:Xh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Xh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Xh(t.height,e.height,e)},{height:9}),h(t.offsetX)||(this.layoutOffsetX=Xh(t.offsetX,e.width,e)),h(t.offsetY)||(this.layoutOffsetY=Xh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{h(this._spec[i])||(e[i]=Xh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};h(n)||(r.width-=n),h(s)||(r.width-=s),h(e)||(r.height-=e),h(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(h(n)?h(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,h(e)?h(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){b(t)&&(this._layoutStartPoint.x=t),b(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){b(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),b(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}_setRectInSpec(t){const e={...t};return this._layoutRectLevelMap.width<9?(h(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),h(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(h(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),h(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class mK extends gK{grammarType;id=tl();_product;getProduct(){if(c(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return c(e)&&c(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){c(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(c(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(c);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class yK extends mK{grammarType=sK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}c(this._value)&&this._product.value(this._value),c(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class _K extends gK{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new yK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class vK extends _K{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(L(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class bK extends vK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class xK extends fK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new uK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=tl(),this._originalSpec=t,this._spec=Jh(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new W$(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new bK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Jh(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(h(t)||h(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=L({},e?.[N(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),m(t))return t.map((t=>d(t)&&!l(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];d(n)&&!l(n)&&(Oh(n)?e[i]=Lh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){c(t)&&c(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!c(t)||!c(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${$j}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=b$.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const SK={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",rectRound:"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"},wK={symbol:function(t,e){return"shape"===t?SK[e]??e:e}};const AK={};Object.values(rK).forEach((t=>{AK[t]=!0}));const kK={[rK.STATE_HOVER]:rK.STATE_HOVER_REVERSE,[rK.STATE_SELECTED]:rK.STATE_SELECTED_REVERSE,[rK.STATE_DIMENSION_HOVER]:rK.STATE_DIMENSION_HOVER_REVERSE};function MK(t){return kK[t]}class CK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!M(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=MK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=MK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=MK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=MK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class TK extends vK{id=tl();stateKeyToSignalName=t=>`${$j}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===nK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===nK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===nK.enter?nK.appear:nK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===nK.enter?nK.appear:nK.none}}}}class EK extends xK{static type="region";modelType="region";type=EK.type;_series=[];layoutType="region";layoutZIndex=$X.Region;animate;interaction=new CK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new TK({getCompiler:e.getCompiler})),c(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:v$.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",HX.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",HX.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:v$.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:v$.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",HX.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex($X.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",HX.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",HX.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",HX.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||N(t.userId).includes(e.userId))&&(!c(t.specIndex)||!e.getSpecIndex||N(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(RX.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new pK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aK)M(t.stateStyle[aK[e]])||this.interaction.registerMark(aK[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class PK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient&&(this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const RK=[v$.line,v$.area,"trail"];function BK(t){return RK.includes(t)}class IK extends vK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];c(n.domain)&&(s.domain=n.domain),c(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=o(BK)?n:!t.mark||BK(t.mark.markType);let s=!1,r=!1;if(c(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!AK[t])).map((t=>[t,10])),n=!t.mark||BK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(m(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith($j)));n=t.datums.some((t=>i&&m(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(d(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith($j)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(Fl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class DK extends mK{grammarType=sK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();h(t)||(h(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class LK extends DK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return c(t)?t:`${$j}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct(t)}}class OK extends mK{grammarType=sK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=$X.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){c(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){h(this._data)&&this.initMarkData({...this._option,mark:this}),c(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new IK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new W$(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new LK(t)}stateKeyToSignalName(t){return`${$j}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(c(e)&&this.removeProduct());if(c(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),h(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(h(this._data))return;this._data.compile();const t=this._data.getProduct();c(this._product)&&c(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[rK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!l(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(lV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===nK.appear&&this.runAnimationByState(nK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),wK[a]?wK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class FK extends OK{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(c(t.id)&&(this._userId=t.id),o(t.interactive)&&(this._interactive=t.interactive),c(t.zIndex)&&this.setZIndex(t.zIndex),o(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(v(t))return xl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(xl)),t}return"function"==typeof t?(e,i,n,s)=>xl(t(e,i,n,s)):t}isUserLevel(t){return[HX.User_Mark,HX.User_Series,HX.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];h(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;c(r)&&r<=n&&L(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(zl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return f(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=jh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;return s=this.stateStyle[i]?.[t]?this._computeStateAttribute(this.stateStyle[i][t],t,e,i,n):this._computeStateAttribute(this.stateStyle.normal[t],t,e,i,n),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,s):s}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):qX.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):zl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",HX.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=l(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,HX.User_Mark,e)}else this.setStyle(i,t,HX.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let h=s,d=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(h=t),d||(d=e)}const u=Ih(Bh(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),p={},g={...ZX[n],...a};return Object.keys(g).forEach((t=>{const n=g[t];"stops"===t?p.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??h?.scale(e[d]);return l(s)&&(a=s(e,this._attributeContext,i,o)),c(n)&&(a=Uo.SetOpacity(a,n)),{offset:l(r)?r(e,this._attributeContext,i,o):r,color:a||u[0]}})):l(n)?p[t]=n(e,this._attributeContext,i,o):p[t]=n})),p.gradient=n,p}_computeThresholdAttr(t){return(new Ch).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class zK extends FK{static type=v$.group;type=zK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Go("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Go("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class HK extends FK{static type=v$.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(QN.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}dK.useMark([HK,zK]),b$.registerRegion("region",EK),b$.registerLayout("base",PK);var jK,NK,VK;Ve.getInstance(Ne.Error),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(jK||(jK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(NK||(NK={}));class WK{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?jh("colorOrdinal"):jh(t.type)),e?(m(t.range)&&e.range(t.range),m(t.domain)&&(il(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),il(n.domain)?e.reRender=!0:z(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{il(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{d$(e,[{key:t,operations:Fl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&d$(e,[{key:i.field,operations:Fl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!il(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=Fl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{Fl(e.type)?(h(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),h(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;Fl(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!h(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(Fl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(Fl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));Fl(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(h(t.field)||!h(t.changeDomain)&&"none"!==t.changeDomain&&!h(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class UK{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(RX.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][NX]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[NX],s>=0?(t[jX]=e,e+=t[NX],t[NX]=e):(t[jX]=i,i+=t[NX],t[NX]=i)})),t.values.forEach((t=>{s=t[NX];const r=s>=0?e:i;n=s>=0?1:-1,t[VX]=Math.min(1,t[jX]/r)*n,t[WX]=Math.min(1,t[NX]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[NX]=function(t){if(b(t))return t;const e=+t;return b(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class GK extends gK{type="chart";id=tl();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:Kj,height:qj};getLayoutRect(){return this._layoutRect}_viewRect={width:Kj,height:qj};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:Kj,y2:qj};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=Kh(t.padding??this._theme?.padding),this._event=new W$(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new UK(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),E(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=b$.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=eK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),c(t.regionId)?i=this.getRegionsInUserId(t.regionId):c(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=b$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&N(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=b$.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(b$.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(RX.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(RX.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>N(t).some((t=>c(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof xK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof FK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof FK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(c(t)&&c(e))this._canvasRect={width:t,height:e};else{let i=Kj,n=qj;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=tn(this._option.container,Kj,qj);i=t,n=e}else if(r&&qo(this._option.mode)){let t;t=f(r)?document?.getElementById(r):r;const{width:e,height:s}=tn(t,Kj,qj);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;if(m(t))e.range=t.map((t=>Lh(t,this._theme?.colorScheme)));else{const i=t;Object.prototype.hasOwnProperty.call(i,"type")&&(e.type=i.type),Object.prototype.hasOwnProperty.call(i,"domain")&&(e.domain=i.domain),Object.prototype.hasOwnProperty.call(i,"range")&&(e.range=i.range),Object.prototype.hasOwnProperty.call(i,"specified")&&(e.specified=i.specified)}}return e.range?.length||(e.range=Bh(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new WK(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Bh(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&N(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};m(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=$h(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(M(t[n]))continue;const s=t[n];let r={stateValue:n};r=l(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rK.STATE_HOVER,!0,t,e,i)}initEvent(){[RX.dataZoomChange,RX.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(lV.AFTER_MARK_RENDER_END,e)};this._event.on(lV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||l(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===N$.dimensionHover||s===N$.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===dn.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===dn.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class YK extends GK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function XK(t){t.crosshair=N(t.crosshair||{}).map((e=>L({[t.direction===Wh.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(VK||(VK={}));const $K=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!h(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!h(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!h(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=c,(h(o)||o===DX)&&(t[DX]=c?l.total:+t[n]>=0?l.increase:l.decrease)})),f={...i,lastIndex:t},d.push(i)})),d},KK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},qK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:ZK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function ZK(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>ZK(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class JK{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new No(e instanceof Ho?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),X$(e,"dimensionTree",qK),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const QK=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},tq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class eq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new uK;_markReverse=new uK;constructor(t,e){this._spec=t,this._option=e,this.event=new W$(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(rK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(rK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(N(i).forEach((e=>{t.on(e,{level:IX.chart},this.onHover)})),n&&"none"!==n&&N(n).forEach((e=>{t.on(e,{level:IX.vchart,source:BX.chart},this.onUnHover)}))),s&&(N(r).forEach((e=>{t.on(e,{level:IX.mark},this.onSelect)})),a&&"none"!==a&&N(a).forEach((e=>{t.on(e,{level:IX.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=tq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;o(i)?this._hover.enable=i:d(i)&&(this._hover.enable=!0,this._hover=L(this._hover,i));const n=this._spec.select;o(n)?this._select.enable=n:d(n)&&(this._select.enable=!0,this._select=L(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,rK.STATE_HOVER)||this.interaction.getEventElement(rK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,rK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(rK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(rK.STATE_HOVER,t.item),this.interaction.reverseEventElement(rK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(rK.STATE_HOVER);this.interaction.clearEventElement(rK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(rK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,rK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(rK.STATE_SELECTED);this.interaction.clearEventElement(rK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(rK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(rK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(rK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(rK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(rK.STATE_SELECTED);const e=this.interaction.getEventElementData(rK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,rK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class iq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const nq=(t,e)=>c(e)?t.map((t=>e[t])):void 0,sq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),rq=t=>!h(t)&&(m(t)?t.length>0&&t.every(c):Object.keys(t).length>0);function aq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(c(s.regionId)?[s.regionId]:void 0,c(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=c(s)?t[s]:void 0,a=c(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=nq(i,t);let d=nq(n,t);const u=rq(d),p=!u&&c(s)&&h(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,c=i.map(((t,e)=>[t,e])).filter((([,t])=>h(l?.[t])));let g=[l??[]];c.length>0&&c.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];g.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),g=s})),g.forEach((l=>{if(p){const r=t.getViewData()?.latestData.filter(sq(i,l));a.forEach((a=>{const c=r.find((t=>t[s]===a));if(d=nq(n,c),!rq(d))return;const p=t.dataToPosition(c);h(p)||isNaN(p.x)||isNaN(p.y)||o.push({pos:p,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===NK.pie){const t=e,a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToCentralPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}else{const t=e;if(p){const c=t.getViewData()?.latestData.filter(sq(i,l)),p=c.find((t=>t[s]===r));a.forEach((r=>{if(d=nq(n,p),!rq(d))return;const a=t.dataToPosition(p);h(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),d=r.getLayoutStartPoint(),u=r.getLayoutRect(),p=n.globalInstance.getContainer(),g={x:0,y:0,...p?en(p):{}},f=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>sq(e,i)(t)&&sq(n,s)(t)&&(h(r)||sq([r],[a])(t))));return o},m=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),u.width),y:Math.min(Math.max(t.y,0),u.height)}))(t),i=s.x??d.x+e.x,n=s.y??d.y+e.y;return{canvasX:i,canvasY:n,clientX:g.x+i,clientY:g.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>f(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:BX.chart,event:m({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return dK.globalConfig.uniqueTooltip&&dK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...f(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:BX.chart,event:m(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return dK.globalConfig.uniqueTooltip&&dK.hideTooltip(a.id),l}return"none"}const oq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return c(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function lq(t){return h(t.mark)&&h(t.model)&&h(t.datum)}class hq extends iq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];c(i)&&(e[t]={...i,title:c(i.title)?l(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:c(i.content)?l(i.content)?i.content:N(i.content).map((t=>l(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=oq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:c(e)?N(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of N(e)){const e=this.series.getSeriesStyle(t)?.(i);if(c(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const cq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},dq={min:t=>t===cq.min()?0:t,max:t=>t===cq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===cq.min()?0:t,"array-max":t=>t===cq.max()?0:t};const uq={min:function(t,e){return el(e)?Math.min(t,e):t},max:function(t,e){return el(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>el(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>el(t)));return 0===i.length?t:Math.max(t,...i)}},pq=(t,e)=>{const i={};let n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;n=d$([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!h(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=cq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=uq[n](i[t.key][n],s)})),i[t.key][n]=dq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},gq=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>el(t[s])));else if("zero"===n)return t.forEach((t=>{el(t[s])||(t[s]=0)})),t;return t};class fq extends DK{_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const mq=`${$j}_HIERARCHY_DEPTH`,yq=`${$j}_HIERARCHY_ROOT`,_q=`${$j}_HIERARCHY_ROOT_INDEX`,vq=()=>({keyMap:new Map});function bq(t,e,i){t&&(this._seriesField||(t[FX]=this.getSeriesKeys()[0]),t[LX]=e,t[OX]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function xq(t,e,i,n=0,s,r){void 0===r&&(r=e),bq.bind(this)(t,e,i),t[mq]=n,t[yq]=s||t[this.getCategoryField()],t[_q]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>xq.bind(this)(e,n,i,t[mq]+1,t[yq],r)))}class Sq extends xK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[jK.label]:{name:jK.label,type:v$.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([v$.line,v$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(RX.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&c(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(RX.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(h(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),o(this._spec.stack)&&(this._stack=this._spec.stack),o(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),o(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),c(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=tK(this._rawData,this._dataSet,{name:`${$j}_series_${this.id}_viewDataFilter`});const t=tK(this._viewDataFilter,this._dataSet,{name:`${$j}_series_${this.id}_viewData`});this._data=new fq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(X$(this._option.dataSet,"invalidTravel",gq),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new JK(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${$j}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${$j}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){X$(this._dataSet,"dimensionStatistics",pq);const n=new No(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=d$(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&d$(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${$j}_series_${this.id}_viewStackData`;this._viewStackData=new No(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(h(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(f(t))return e[t];if(m(t)&&t.every((t=>f(t))))return t.map((t=>e[t])).join("-");if(l(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(X$(this._rawData.dataSet,"addVChartProperty",QK),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(RX.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(RX.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(RX.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(RX.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(RX.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||h(e)?[]:f(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:v$.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${$j}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${$j}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||h(t.dataId)&&h(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new eq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??FX;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:zX,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,zX)}))}afterInitMark(){this.event.emit(RX.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",HX.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new hq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??FX,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Bh(this._option.getTheme().colorScheme,this.type);return(new zh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??FX}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=L({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:l,dataProductId:d,parent:u,isSeriesMark:p,dataStatistics:g,depend:f,label:m,progressive:y,support3d:_=this._spec.support3d||!!this._spec.zField,morph:v=!1}=e,b=super._createMark(t,{key:i??this._getDataIdKey(),support3d:_,dataStatistics:g??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(c(b)){this._marks.addMark(b),p&&(this._seriesMark=b),h(u)?this._rootMark?.addMark(b):!1!==u&&u.addMark(b),h(l)?(b.setDataView(this.getViewData(),this.getViewDataProductId()),b.setSkipBeforeLayouted(!0)):!1!==l&&b.setDataView(l,d),o(s)&&b.setSkipBeforeLayouted(s),c(f)&&b.setDepend(...N(f)),c(m)&&b.setLabelSpec(m);const t=this.getSpec()||{};b.setMorph(v),b.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),b.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),h(y)||b.setProgressiveConfig(y),h(n)||b.setGroupKey(n),this.initMarkStyleWithSpec(b,L({},r,a||t[b.name]))}return b}_getDataIdKey(){return super._getDataIdKey()??OX}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==NX&&t!==WX&&t!==jX&&t!==VX||(t=this.getStackValueField()),p$(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=b$.getSeries(this.type);return Object.values(t.mark??{})}return t}}class wq extends Sq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=N(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=N(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&N(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=Wh.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&this._fieldX.forEach((e=>{const i={key:e,operations:[]};Fl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&this._fieldY.forEach((e=>{const i={key:e,operations:[]};Fl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};Fl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===Wh.vertical?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction===Wh.vertical?(this.setFieldY(NX),this.setFieldY2(jX)):(this.setFieldX(NX),this.setFieldX2(jX))}setValueFieldToPercent(){this.direction===Wh.vertical?(this.setFieldY(WX),this.setFieldY2(VX)):(this.setFieldX(WX),this.setFieldX2(VX))}setValueFieldToStackOffsetSilhouette(){this.direction===Wh.vertical?(this.setFieldY(GX),this.setFieldY2(UX)):(this.setFieldX(GX),this.setFieldX2(UX))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Wo(t.xField,i)&&Wo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),c(this._spec.direction)&&(this._direction=this._spec.direction),this._direction===Wh.vertical?(this.setFieldY2("y1"),this.setFieldX2(this._spec?.x2Field)):(this.setFieldX2("x1"),this.setFieldY2(this._spec?.y2Field)),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[0]:Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===Wh.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===Wh.vertical?N(this._spec.yField??this.fieldY):N(this._spec.xField??this.fieldX)}}const Aq=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};const kq={type:"clipIn"},Mq={type:"fadeIn"};function Cq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===Wh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Wh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Mq;default:return kq}}function Tq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=i?.[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const Eq=(t,e=!0)=>({type:t.direction===Wh.horizontal?"growWidthIn":"growHeightIn",options:Tq(t,e)}),Pq=(t,e=!0)=>({type:t.direction===Wh.horizontal?"growWidthOut":"growHeightOut",options:Tq(t,e)}),Rq={type:"fadeIn"},Bq={type:"growCenterIn"};function Iq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Rq;case"scaleIn":return Bq;default:return Eq(t)}}const Dq={type:"clipIn"},Lq={type:"fadeIn"};function Oq(t,e){switch(e){case"grow":return(t=>({type:t.direction===Wh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Wh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Lq;default:return Dq}}function Fq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const zq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Fq(t,!0,nK.appear)}),Hq={type:"fadeIn"},jq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Fq(t,!0,nK.enter)}),Nq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Fq(t,!0,nK.exit)}),Vq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:Fq(t,!0,nK.exit)});function Wq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Hq;case"growRadius":return zq({...t,growField:"radius"});default:return zq({...t,growField:"angle"})}}const Uq={type:"fadeIn"};function Gq(t,e){return"fadeIn"===e?Uq:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function Yq(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const Xq=t=>({type:t.direction===Wh.horizontal?"growWidthOut":"growHeightOut",options:Yq(t)}),$q={type:"fadeIn"};function Kq(t,e){return!1===e?{}:"fadeIn"===e?$q:(t=>({type:t.direction===Wh.horizontal?"growWidthIn":"growHeightIn",options:Yq(t)}))(t)}const qq=t=>({type:"in"===t?"fadeIn":"fadeOut"});function Zq(t,e,i){return"fadeIn"===e?qq(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function Jq(t,e,i){return"fadeIn"===e?qq(i):((t,e)=>{const i=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const Qq=(t,e)=>({custom:RC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class tZ extends oC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;l(r)&&l(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);b(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);b(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class eZ extends EC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Ht(d,u,p,g);return f.defined=e.defined,f}}const iZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},nZ={type:"fadeIn"},sZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),rZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),aZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function oZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return nZ;case"growAngle":return iZ({...t,growField:"angle"});default:return iZ({...t,growField:"radius"})}}const lZ={type:"fadeIn"},hZ={type:"growCenterIn"};function cZ(t,e){switch(e){case"fadeIn":return lZ;case"scaleIn":return hZ;default:return Eq(t,!1)}}const dZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},uZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),pZ={type:"fadeIn"},gZ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function fZ(t,e){return"fadeIn"===e?pZ:uZ(t)}const mZ=t=>({custom:IC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),yZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},_Z=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},vZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===JN.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},bZ=(t,e,i)=>{if(M(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},xZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=bZ(r,n,s);return _Z(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=bZ(r,n,s);return _Z(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),SZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},wZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=SZ(r);return _Z(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=SZ(r);return _Z(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),AZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},kZ={type:"fadeIn"};function MZ(t){return!1===t?{}:kZ}const CZ={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},TZ={bar:(t,e)=>({appear:Iq(t,e),enter:Eq(t,!1),exit:Pq(t,!1),disappear:Pq(t)}),bar3d:(t,e)=>({appear:Iq(t,e),enter:Eq(t,!1),exit:Pq(t,!1),disappear:Pq(t)}),line:(t,e)=>({appear:Oq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:EC,duration:CZ.update.duration,easing:CZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:Cq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:Wq(t,e),enter:jq(t),exit:Nq(t),disappear:Vq(t)}),pie3d:(t,e)=>({appear:Wq(t,e),enter:jq(t),exit:Nq(t),disappear:Vq(t)}),rose:(t,e)=>({appear:oZ(t,e),enter:sZ(t),exit:rZ(t),disappear:aZ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:Zq(t,e,"in"),enter:Zq(t,e,"in"),exit:Zq(t,e,"out"),disappear:"clipIn"===e?void 0:Zq(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:eZ,customParameters:t,duration:CZ.update.duration,easing:CZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:Jq(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:Jq(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:tZ,customParameters:t,duration:CZ.update.duration,easing:CZ.update.easing}]}),radarGroup:(t,e)=>({appear:Qq(t,"in"),disappear:Qq(t,"out")}),circularProgress:(t,e)=>({appear:Gq(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:dZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:Kq(t,e),enter:{type:"grow"},disappear:Xq(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:BC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:BC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:mZ(t)}),rangeColumn:(t,e)=>({appear:fZ(t,e),enter:uZ(t),exit:gZ(t),disappear:gZ(t)}),waterfall:(t,e)=>({appear:cZ(t,e),enter:Eq(t,!1),exit:Pq(t,!1),disappear:Pq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:yZ(0,e),enter:xZ(t),exit:wZ(t),disappear:wZ(t)}),circlePacking:(t,e)=>({appear:AZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:MZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:uG},update:{custom:dG},exit:{custom:DC}})},EZ=["appear","enter","update","exit","disappear","normal"];function PZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=l(n)?n(t,s,r):b(n)?n:0;let h=l(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(o+h))},delete t.oneByOne,t}function IZ(t){return t?.[LX]}function DZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function LZ(t){return!function(t){return c(t.timeSlices)}(t)&&c(t.channel)}class OZ extends FK{static type=v$.rect;type=OZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class FZ extends FK{static type=v$.text;type=FZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}dK.useMark([OZ,FZ]);class zZ extends wq{static type=NK.bar;type=NK.bar;_barMarkName=jK.bar;_barMarkType=v$.rect;static mark={...Sq.mark,[jK.bar]:{name:jK.bar,type:v$.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...zZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:DZ(this._spec.animation,this._spec.morph,RZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===Wh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Nh(this.dataToPositionX(e),t),x1:e=>Nh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Fl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",HX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Fl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Nh(this.dataToPositionY(t),e),y1:t=>Nh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",HX.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Nh(this.dataToPositionX(e),t),x1:e=>Nh(this.dataToPositionX1(e),t),y:t=>Nh(this.dataToPositionY(t),e),y1:t=>Nh(this.dataToPositionY1(t),e)},"normal",HX.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(PZ(TZ.bar(t,e),RZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Aq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Aq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Aq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class HZ extends FK{static type=v$.rule;type=HZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}dK.useMark([HZ]);class jZ extends zZ{static type=NK.waterfall;type=NK.waterfall;static mark={...zZ.mark,[jK.leaderLine]:{name:jK.leaderLine,type:v$.rule},[jK.stackLabel]:{name:jK.stackLabel,type:v$.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],h(this._seriesField)&&(this._seriesField=DX)}getSeriesKeys(){return this._seriesField===DX?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),X$(this._dataSet,"waterfallFillTotal",KK),X$(this._dataSet,"waterfall",$K),(h(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=tK(this.getViewData(),this._dataSet,{name:`${$j}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new fq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jX,endAs:NX,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(PZ(TZ.waterfall(t,e),RZ(jK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec),{dataIndex:i}))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(jZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(jZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n}=this._xAxisHelper;return this._direction===Wh.vertical?n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("width",t)*i:Nh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n}=this._yAxisHelper;return this._direction===Wh.vertical?Nh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("height",t)*i}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===Wh.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",HX.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",HX.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===Wh.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const NZ=`${$j}_BOX_PLOT_OUTLIER_VALUE`;var VZ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(VZ||(VZ={}));const WZ=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];m(e)||(e=[e]),i.push(...e.map((e=>{const i={[NZ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class UZ extends hq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(VZ.OUTLIER),value:this.getContentValue(VZ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(VZ.MAX),value:this.getContentValue(VZ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.Q3),value:this.getContentValue(VZ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.MEDIAN),value:this.getContentValue(VZ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.Q1),value:this.getContentValue(VZ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.MIN),value:this.getContentValue(VZ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.SERIES_FIELD),value:this.getContentValue(VZ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===VZ.OUTLIER)return this.series.getOutliersField();if(t===VZ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case VZ.MIN:return this.series.getMinField();case VZ.MAX:return this.series.getMaxField();case VZ.MEDIAN:return this.series.getMedianField();case VZ.Q1:return this.series.getQ1Field();case VZ.Q3:return this.series.getQ3Field();case VZ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===VZ.OUTLIER)return e[NZ];if(t===VZ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case VZ.MIN:return e[this.series.getMinField()];case VZ.MAX:return e[this.series.getMaxField()];case VZ.MEDIAN:return e[this.series.getMedianField()];case VZ.Q1:return e[this.series.getQ1Field()];case VZ.Q3:return e[this.series.getQ3Field()];case VZ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>c(t[NZ])}class GZ extends FK{static type=v$.boxPlot;type=GZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(XN("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(eW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),KV("barBoxplotScaleIn",qV(tW)),KV("barBoxplotScaleOut",ZV(tW))):(XN("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(QV).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),KV("boxplotScaleIn",qV(JV)),KV("boxplotScaleOut",ZV(JV)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class YZ extends FK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:M$.circle,fill:void 0,lineWidth:0}}}class XZ extends YZ{static type=v$.symbol;type=XZ.type}dK.useMark([GZ,XZ]);class $Z extends wq{static type=NK.boxPlot;type=NK.boxPlot;static mark={...Sq.mark,[jK.boxPlot]:{name:jK.boxPlot,type:v$.boxPlot},[jK.outlier]:{name:jK.outlier,type:v$.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark($Z.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark($Z.mark.outlier,{progressive:t,key:LX,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===Wh.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,rK.STATE_NORMAL,HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:v(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},rK.STATE_NORMAL,HX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===Wh.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Nh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Nh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Nh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Nh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Nh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},rK.STATE_NORMAL,HX.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===Wh.vertical?{x:this.dataToPositionX.bind(this),y:e=>Nh(t(this.getDatumPositionValues(e,NZ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Nh(t(this.getDatumPositionValues(e,NZ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,rK.STATE_NORMAL,HX.Series)}}initData(){if(super.initData(),!this._data)return;X$(this._dataSet,"foldOutlierData",WZ),X$(this._dataSet,"addVChartProperty",QK);const t=new No(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${$j}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===Wh.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1),this._outlierDataView=new fq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===Wh.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===Wh.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===Wh.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(TZ.boxPlot()),i=this._initAnimationSpec(RZ(jK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(PZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(PZ(TZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new UZ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class KZ{setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([v$.line,v$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(qZ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",HX.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:k$},"normal",HX.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===A$?t===Wh.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",HX.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",HX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(qZ.point,{morph:DZ(this._spec.animation,this._spec.morph,RZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",HX.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?el(t[this.getStackValueField()]):"link"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?el(t[this.getStackValueField()]):"link"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series))}}const qZ={[jK.point]:{name:jK.point,type:v$.symbol},[jK.line]:{name:jK.line,type:v$.line}};class ZZ extends FK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((c=>{const d=t[c];if(h(d)||s.includes(c))return;a&&r.includes(c)&&(zl(d?.type)||d?.scale||l(d))&&(o=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class JZ extends ZZ{static type=v$.line;type=JZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===NK.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}dK.useMark([JZ,XZ,FZ]);class QZ extends wq{static type=NK.line;type=NK.line;_invalidType="break";static mark={...Sq.mark,...qZ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(PZ(TZ.line(t,e),RZ(jK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(PZ(TZ.symbol(),RZ(jK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}j(QZ,KZ);class tJ extends FK{static type=v$.rect3d;type=tJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}dK.useMark([tJ,FZ]);class eJ extends zZ{static type=NK.bar3d;type=NK.bar3d;static mark={...Sq.mark,[jK.bar3d]:{name:jK.bar3d,type:v$.rect3d}};_barMarkName=jK.bar3d;_barMarkType=v$.rect3d}function iJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===Wh.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if(l()===Wh.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=s(t),o=r(t);if(e===Wh.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===Wh.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",HX.Series)}class nJ extends hq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Wh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class sJ extends zZ{static type=NK.rangeColumn;type=NK.rangeColumn;_barMarkType=v$.rect;_barName=NK.bar;static mark={...zZ.mark,[jK.minLabel]:{name:jK.minLabel,type:v$.text},[jK.maxLabel]:{name:jK.maxLabel,type:v$.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(sJ.mark.bar,{morph:DZ(this._spec.animation,this._spec.morph,RZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===QX.bothEnd?void 0:L({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===QX.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(sJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(sJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Wh.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});iJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Wh.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});iJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===Wh.horizontal?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===Wh.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===Wh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Nh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Nh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Fl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",HX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Fl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Nh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Nh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",HX.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(PZ(TZ.rangeColumn({direction:this.direction},e),RZ(jK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new nJ(this)}}dK.useMark([tJ]);class rJ extends sJ{static type=NK.rangeColumn3d;type=NK.rangeColumn3d;_barMarkType=v$.rect3d;_barName=NK.bar3d}class aJ extends ZZ{static type=v$.area;type=aJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}dK.useMark([JZ,aJ,FZ,XZ]);class oJ extends wq{static type=NK.area;type=NK.area;static mark={...Sq.mark,...qZ,[jK.area]:{name:jK.area,type:v$.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(oJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===A$?this._direction===Wh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Wh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Nh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",HX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Nh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",HX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(i,{curveType:e},"normal",HX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(PZ(TZ.line(t,e),RZ(jK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(PZ(TZ.area(t,e),RZ(jK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(PZ(TZ.symbol(),RZ(jK.point,this._spec)))}}j(oJ,KZ);class lJ extends hq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Wh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class hJ extends oJ{static type=NK.rangeArea;type=NK.rangeArea;static mark={...oJ.mark};initMark(){this._areaMark=this._createMark(hJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===A$?this._direction===Wh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Wh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this)},"normal",HX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",HX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(i,{curveType:e},"normal",HX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new lJ(this)}}wr();const cJ={},dJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function uJ(t,e){t&&f(t)||rl("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(cJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=wr().projection(n),n.copy=n.copy||function(){const t=i();return dJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),cJ[i]||null}const pJ={albers:Vr,albersusa:function(){var t,e,i,n,s,r,a=Vr(),o=Nr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Nr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(pJ).forEach((t=>{uJ(t,pJ[t])}));const gJ="Feature",fJ="FeatureCollection";function mJ(t){const e=N(t);return 1===e.length?e[0]:{type:fJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===fJ?t.features:N(t).filter((t=>!h(t))).map((t=>t.type===gJ?t:{type:gJ,geometry:t}))}(e))),[])}}const yJ=dJ.concat(["pointRadius","fit","extent","size"]);function _J(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{yJ.includes(n)&&(i=i.concat(DN(t[n],e)))})),i):i}const vJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(h(i))for(let i=0;i(l(t),t)))};class bJ extends Sq{type=NK.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(h(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(h(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return h(r)||isNaN(r.x)||isNaN(r.y)?null:r}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${$j}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const xJ=(t,e)=>(t.features&&t.features.forEach((t=>{e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class SJ extends hq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class wJ extends FK{static type=v$.path;type=wJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var AJ,kJ,MJ;dK.useMark([wJ,FZ]),AJ="projection",kJ=class extends MW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return h(this.spec.pointRadius)||this.detach(DN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(DN(t,this.view)),this.commit(),this}size(t){return h(this.spec.size)||this.detach(DN(this.spec.size,this.view)),this.spec.size=t,this.attach(DN(t,this.view)),this.commit(),this}extent(t){return h(this.spec.extent)||this.detach(DN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(DN(t,this.view)),this.commit(),this}fit(t){return h(this.spec.fit)||this.detach(DN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(DN(t,this.view)),this.commit(),this}configure(t){return this.detach(_J(this.spec,this.view)),h(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(_J(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=uJ((t||"mercator").toLowerCase());return e||rl("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),dJ.forEach((t=>{var i,n,s;h(this.spec[t])||(i=this.projection,n=t,s=ON(this.spec[t],e,uJ),l(i[n])&&i[n](s))})),h(this.spec.pointRadius)||this.projection.path.pointRadius(ON(this.spec.pointRadius,e,uJ)),!(h(this.spec.fit)||h(this.spec.extent)&&h(this.spec.size))){const t=mJ(ON(this.spec.fit,e,uJ));this.spec.extent?this.projection.fitExtent(ON(this.spec.extent,e,uJ),t):this.spec.size&&this.projection.fitSize(ON(this.spec.size,e,uJ),t)}return this.projection}output(){return this.projection}},MJ="projections",aX[AJ]={grammarClass:kJ,specKey:null!=MJ?MJ:AJ};class CJ extends bJ{static type=NK.map;type=NK.map;static mark={...Sq.mark,[jK.area]:{name:jK.area,type:v$.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),!this.map)throw new Error(`map type '${this.map}' is not specified !`);if(!K$.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),X$(this._dataSet,"copyDataView",Q$),X$(this._dataSet,"map",xJ),X$(this._dataSet,"lookup",vJ);const t=K$.get(this.map);if(!t)throw Error("no valid map data found!");const e=new No(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??FX,OX],as:[this.nameField,this.valueField,this._seriesField??FX,OX]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new fq(this._option,e)}initMark(){this._pathMark=this._createMark(CJ.mark.area,{morph:DZ(this._spec.animation,this._spec.morph,RZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(CJ.mark.label,{skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>c(t[this._seriesField??FX])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??FX]):this._theme?.defaultFillColor,path:this.getPath.bind(this)},"normal",HX.Series),this.setMarkStyle(t,{smoothScale:!0},"normal",HX.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(PZ(TZ.path(),RZ(jK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec)))}initTooltip(){this._tooltipHelper=new SJ(this)}getPath(t){const e=this._areaCache.get(t?.properties?.[this._nameProperty]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t?.properties?.[this._nameProperty],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===v$.path?s.forEach((t=>{t.getGraphicItem().scale(e,e,i)})):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===v$.path?n.forEach((t=>{t.getGraphicItem().translate(e[0],e[1])})):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return b(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]??t.properties?.[this.nameField]??""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return t=>t?.properties?.[this._nameProperty]}}class TJ extends Sq{coordinate="polar";_outerRadius=AN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=c(t)?N(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=c(t)?N(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=N(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(h(t)||h(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(t)),n=this.radiusAxisHelper.dataToPosition(N(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};Fl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};Fl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),c(this._spec.radius)&&(this._outerRadius=this._spec.radius),c(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Wo(t.angleField,i)&&Wo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const EJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=bl(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},PJ=(t,e)=>{const i=t[0].latestData;return new BJ(e.series,i).updateLabels()};class RJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class BJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=h$(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[tN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:c}=n;if("inside"!==t?.position){const t=Al(e.x,e.y,this._series.computeDatumRadius(s,rK.STATE_HOVER),n.middleAngle),i=Al(e.x,e.y,this._series.computeDatumRadius(s,rK.STATE_SELECTED),n.middleAngle),a=Al(e.x,e.y,this._series.computeDatumRadius(s,rK.STATE_NORMAL),n.middleAngle);s[hN]=a.x,s[cN]=a.y,s[oN]=t.x,s[lN]=t.y,s[fN]=i.x,s[mN]=i.y,s[dN]=l.x,s[uN]=l.y,s[pN]=c.x,s[gN]=c.y,s[iN]=r.y-o.height/2}else s[iN]=r.y;return s[Jj]=this._computeAlign(n),s[Zj]=Math.max(a,0),s[tN]=n.labelVisible&&!h(n.labelText),s[eN]=r.x,s[Qj]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=Al(e.x,e.y,f,t.middleAngle),t.labelLimit=p,at(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=kl(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=kl(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(ot(t.pointB.x,n+r)||at(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?vl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?h(i)||"auto"===i?"edge"===n?kl(t.quadrant)?"left":"right":kl(t.quadrant)?"right":"left":i:h(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=h(n)||h(t[n])||h(t[s]);return l(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class IJ extends FK{type=DJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+wl({angle:e[yN],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class DJ extends IJ{static type=v$.arc;type=DJ.type}dK.useMark([wJ,FZ,DJ]);class LJ extends TJ{_pieMarkName=jK.pie;_pieMarkType=v$.arc;static mark={...Sq.mark,[jK.pie]:{name:jK.pie,type:v$.arc},[jK.labelLine]:{name:jK.labelLine,type:v$.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=bN;_endAngle=xN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=c(t),r=c(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(c(this._spec?.startAngle)?xl(this._spec.startAngle):this._startAngle,c(this._spec?.endAngle)?xl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=c(this._spec?.padAngle)?xl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;X$(this._dataSet,"pie",EJ),X$(this._dataSet,"arcLabel",PJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:sN,asEndAngle:rN,asRatio:nN,asMiddleAngle:yN,asRadian:vN,asQuadrant:_N,asK:aN}},!1);const e=new No(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${$j}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new fq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...LJ.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:DZ(this._spec.animation,this._spec.morph,RZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark(LJ.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark(LJ.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Vh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Vh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ll(sN).bind(this),endAngle:Ll(rN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",HX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,HX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Ll(tN).bind(this),x:Ll(eN).bind(this),y:Ll(iN).bind(this),text:Ll(Qj).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ll(Jj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[yN];return"inside"===this._spec.label?.position?Sl(e):0},limit:Ll(Zj).bind(this)},void 0,HX.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Ll(tN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(RX.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return t?.outerRadius&&(e.outerRadius=()=>this.computeLayoutRadius()*t?.outerRadius),t?.innerRadius&&(e.innerRadius=()=>this.computeLayoutRadius()*t?.innerRadius),t?.cornerRadius&&(e.cornerRadius=()=>this.computeLayoutRadius()*t?.cornerRadius),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${$j}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${$j}_ARC_LABEL_${e}_AY`])} L${Math.round(t[dN])},${Math.round(t[uN])} L${Math.round(t[pN])},${Math.round(t[gN])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(h(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[yN];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=wl({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[yN];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=wl({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===nK.appear)return this._startAngle;if(i===nK.disappear)return this._endAngle;const n=[nK.disappear,nK.exit],s=e.mark.elements,r=t,a=r?.[LX];if(void 0===s.find((t=>t.data[0]?.[LX]t.data[0]?.[LX]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[LX]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+wl({angle:e[yN],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+wl({angle:e[yN],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+wl({angle:e[yN],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+wl({angle:e[yN],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class OJ extends LJ{static type=NK.pie;type=NK.pie}class FJ extends IJ{static type=v$.arc3d;type=FJ.type}dK.useMark([wJ,FZ,FJ]);class zJ extends LJ{static type=NK.pie3d;type=NK.pie3d;_pieMarkName=jK.pie3d;_pieMarkType=v$.arc3d;static mark={...Sq.mark,[jK.pie3d]:{name:jK.pie3d,type:v$.arc3d},[jK.labelLine]:{name:jK.labelLine,type:v$.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ll(sN).bind(this),endAngle:Ll(rN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",HX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,HX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Ll(eN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Ll(iN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Ll(tN).bind(this),x:Ll(eN).bind(this),y:Ll(iN).bind(this),text:Ll(Qj).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ll(Jj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[yN];return"inside"===this._spec.label?.position?Sl(e):0},limit:Ll(Zj).bind(this),...n},void 0,HX.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Ll(tN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const HJ=[10,20],jJ=Ol.Linear,NJ="circle",VJ=Ol.Ordinal,WJ=["circle","square","triangle","diamond","star"];dK.useMark([XZ,FZ]);class UJ extends wq{static type=NK.scatter;type=NK.scatter;static mark={...Sq.mark,[jK.point]:{name:jK.point,type:v$.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if(l(e))return e;if(m(e)){if(h(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${$j}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(d(e)){if(h(t))throw new Error(`${s}Field is required.`);const r={id:`${$j}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return h(e)?10:v(e)?e:!f(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:jJ,defaultRange:HJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return h(e)?NJ:f(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:VJ,defaultRange:WJ},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(UJ.mark.point,{morph:DZ(this._spec.animation,this._spec.morph,RZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(PZ(TZ.scatter({},t),RZ(jK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:v(this._size)||l(this._size)?this._size:10,shape:f(this._shape)||l(this._shape)?this._shape:NJ},rK.STATE_NORMAL,HX.Series),(c(this._sizeField)||c(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},rK.STATE_NORMAL,HX.User_Mark),(c(this._shapeField)||c(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},rK.STATE_NORMAL,HX.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||el(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},rK.STATE_NORMAL,HX.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class GJ extends TJ{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(NX),this.setInnerRadiusField(jX)}setValueFieldToPercent(){this.setRadiusField(WX),this.setInnerRadiusField(VX)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}dK.useMark([DJ,FZ]);class YJ extends GJ{static type=NK.rose;type=NK.rose;static mark={...zZ.mark,[jK.rose]:{name:jK.rose,type:v$.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(YJ.mark.rose,{morph:DZ(this._spec.animation,this._spec.morph,RZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(YJ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Nh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Nh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Nh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(Sl(e)??0)+90},void 0,HX.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(PZ(TZ.rose(e,t),RZ(jK.rose,this._spec)))}}}dK.useMark([aJ,JZ,XZ,FZ]);class XJ extends GJ{static type=NK.radar;type=NK.radar;static mark={...Sq.mark,...qZ,[jK.area]:{name:jK.area,type:v$.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(XJ.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:k$},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:xl(this._spec.startAngle)??bN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(PZ(TZ.radarGroup(t,e),RZ(jK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(c(i)){const s=TZ[n];i.setAnimationConfig(PZ(s(t,e),RZ(i.name,this._spec)))}}))}}j(XJ,KZ);class $J extends hq{updateTooltipSpec(){super.updateTooltipSpec(),c(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>Vo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const KJ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},qJ={fill:"#bbb",fillOpacity:.2};dK.useMark([XZ,FZ,HZ,OZ]);class ZJ extends wq{static type=NK.dot;type=NK.dot;static mark={...Sq.mark,[jK.group]:{name:jK.group,type:v$.group},[jK.grid]:{name:jK.grid,type:v$.rule},[jK.gridBackground]:{name:jK.gridBackground,type:v$.rect},[jK.dot]:{name:jK.dot,type:v$.symbol},[jK.title]:{name:jK.title,type:v$.text},[jK.subTitle]:{name:jK.subTitle,type:v$.text},[jK.symbol]:{name:jK.symbol,type:v$.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){c(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){c(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){c(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){c(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){c(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),X$(this._option.dataSet,"objFlat",KJ),X$(this._option.dataSet,"copyDataView",Q$),$$(this._option.dataSet,"dataview",Oo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([v$.line,v$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(L(qJ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(ZJ.mark.group),this._containerMark=this._createMark(ZJ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(ZJ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(ZJ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(ZJ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(ZJ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(ZJ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(ZJ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",HX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",HX.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",HX.Series),this._trigger.registerMark(i));const n=this._gridMark;n&&(this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",HX.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",HX.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",HX.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",HX.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(o))}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??FX}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Bh(this._option.getTheme().colorScheme,this.type);return(new zh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??FX}}initTooltip(){this._tooltipHelper=new $J(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class JJ extends hq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>Vo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}dK.useMark([HZ,XZ]);class QJ extends wq{static type=NK.link;type=NK.link;static mark={...Sq.mark,[jK.group]:{name:jK.group,type:v$.group},[jK.link]:{name:jK.link,type:v$.rule},[jK.arrow]:{name:jK.arrow,type:v$.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){c(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){c(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){c(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();X$(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(QJ.mark.group),this._containerMark=this._createMark(QJ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(QJ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(QJ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",HX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",HX.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",HX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?M$.triangleDown:M$.triangleUp},"normal",HX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??FX}}initTooltip(){this._tooltipHelper=new JJ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class tQ extends TJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=xl(this._spec.startAngle)??xl(t?.startAngle)??bN,this._endAngle=xl(this._spec.endAngle)??xl(t?.endAngle)??xN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||c(n?.startAngle)||c(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Nh(this.angleAxisHelper.dataToPosition([t[jX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Nh(this.angleAxisHelper.dataToPosition([t[NX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class eQ extends IJ{static type=v$.arc;static constructorType=v$.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){c(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),c(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const h=c(t.innerPadding)&&c(a)||c(t.outerPadding)&&c(o),d=c(t.innerRadius)&&s||c(t.outerRadius)&&r;if(h||d){const e=Object.assign({},t);return s&&c(a)&&(l(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+(l(s)?s(t,e,i,n):s):l(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&c(o)&&(l(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-(l(r)?r(t,e,i,n):r):l(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}dK.useMark([DJ,eQ]);class iQ extends tQ{static type=NK.circularProgress;type=NK.circularProgress;static mark={...Sq.mark,[jK.track]:{name:jK.track,type:v$.progressArc},[jK.progress]:{name:jK.progress,type:v$.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(iQ.mark.track),this._progressMark=this._createMark(iQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(PZ(TZ.circularProgress({startAngle:this._startAngle},t),RZ(jK.progress,this._spec))),this._trackMark.setAnimationConfig(PZ(TZ.progressBackground(),RZ(jK.track,this._spec)))}}class nQ extends hq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}dK.useMark([OZ]);class sQ extends wq{static type=NK.linearProgress;type=NK.linearProgress;static mark={...Sq.mark,[jK.track]:{name:jK.track,type:v$.rect},[jK.progress]:{name:jK.progress,type:v$.rect},[jK.group]:{name:jK.group,type:v$.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(sQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Nh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Nh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Nh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Nh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(sQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Nh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Nh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(sQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Nh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(lB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Nh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(lB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",HX.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(PZ(TZ.linearProgress(t,e),RZ(jK.progress,this._spec))),this._trackMark.setAnimationConfig(PZ(TZ.progressBackground(),RZ(jK.track,this._spec)))}initTooltip(){this._tooltipHelper=new nQ(this)}}const rQ=[0],aQ=[20,40],oQ=[200,500],lQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},hQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],cQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:dQ,triangle:dQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function dQ(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function uQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const pQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function gQ(t){return l(t)?t:function(){return t}}class fQ{constructor(t){var e,i;switch(this.options=Object.assign({},fQ.defaultOptions,t),l(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>cQ[t]?cQ[t]():cQ.circle())(this.options.shape),this.getText=null!==(e=gQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=gQ(this.options.fontWeight),this.getTextFontSize=gQ(this.options.fontSize),this.getTextFontStyle=gQ(this.options.fontStyle),this.getTextFontFamily=gQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>pQ(10,50);break;case"random-light":this.getTextColor=()=>pQ(50,90);break;default:this.getTextColor=gQ(this.options.color)}if(h(this.options.rotate)){if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}}else this.getTextRotate=l(this.options.rotate)?t=>{var e;return Ut(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Ut(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!h(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class yQ extends fQ{constructor(t){var e;super(Object.assign({},yQ.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.spiral=f(this.options.spiral)?null!==(e=mQ[this.options.spiral])&&void 0!==e?e:mQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=gQ(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:n}=uQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));for(this.data=r;s>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(xQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(bQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}xQ(p,this._size)&&(p=SQ(p,this._size))}else if(xQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||vQ(p,i))&&(!i||!_Q(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function _Q(t,e,i){const n=i[0]>>5,s=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function vQ(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,xQ=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function SQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),G(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=uQ(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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(;ie.left+e.width||t.top>e.top+e.height)}AQ.defaultOptions={enlarge:!1};const MQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},CQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?TQ(t.fontFamily):"sans-serif",u=t.fontStyle?TQ(t.fontStyle):"normal",p=t.fontWeight?TQ(t.fontWeight):"normal",g=t.rotate?TQ(t.rotate):0,f=TQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?TQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",b=null!==(r=t.shrink)&&void 0!==r&&r,x=null!==(a=t.enlarge)&&void 0!==a&&a,S=null!==(o=t.clip)&&void 0!==o&&o,w=null!==(l=t.minFontSize)&&void 0!==l?l:0,A=t.randomVisible,k=t.as||MQ,M=t.depth_3d,C=t.postProjection;let T=t.fontSize?TQ(t.fontSize):14;const E=t.fontSizeRange;if(E&&!v(T)){const t=T;T=e=>EQ(t(e),PQ(t,h),E)}let P=yQ;"fast"===t.layoutType?P=AQ:"grid"===t.layoutType&&(P=wQ);const R=new P({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:T,shrink:b,clip:S,enlarge:x,minFontSize:w,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},TQ=t=>f(t)||v(t)||l(t)?t:e=>e[t.field],EQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],PQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function RQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),DQ=(t,e)=>{let i=0;for(const e of t)IQ(e)?i+=1:i+=.53;return i};function LQ(t){return x(t)?new Promise(((e,i)=>{const n=uB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{Ve.getInstance().error("image 加载失败!",t)}})):null}var OQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function FQ(t){return OQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield LQ(e);r&&(a=yield function(t,e,i){return OQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&HQ(s,n,a-1);)--a;for(;oo&&jQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield LQ(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||zQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function zQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function HQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=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")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||UQ(e,t,r)))return WQ(e,t,r),!0}return!1}function WQ(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function UQ(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function GQ(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(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,s,u).data;let f,m;for(;--n>=p;){const t=i[n];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;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(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 YQ(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=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++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=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?NQ(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=YQ(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return NQ(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){GQ(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!UQ(i,y,_)&&(WQ(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var KQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const qQ={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},ZQ=(t,e,i,n)=>KQ(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||rl("WordcloudShape shape must be specified."),t.text||rl("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(BQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||qQ;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=pj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield FQ(l),p=t.colorMode||"ordinal",g={getText:i0(t.text),getFontSize:i0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?i0(t.colorField):i0(t.text),getFillingColor:i0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:i0(t.colorHexField),getFontFamily:i0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:i0(t.padding||1),getFontStyle:i0(t.fontStyle||"normal"),getFontWeight:i0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?i0(t.fontOpacity):()=>1};QQ(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:i0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:i0(t.fillingFontStyle||"normal"),getFillingFontWeight:i0(t.fillingFontWeight||"normal"),getFillingPadding:i0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((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{const i=DQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,P=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),R=Math.max(...P.map((t=>t.fontSize)));P.forEach((t=>t.weight=t.fontSize/R)),P.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield $Q(P,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(BQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),JQ=(t,e,i,n)=>{var s,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 Vl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Vl).domain(e).range(f).scale(t)}}else(new yh).domain(e0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new yh).domain(e0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},QQ=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new kh).domain(e0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&l(s)&&!n){const e=.5,[o,l]=(i.shapeArea,e0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=t0(h,i,!0);n=[~~(e*c),~~c];const d=(new kh).domain(e0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=t0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},t0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=DQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},i0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:l(t)?t:e=>e[t.field]:null,n0=`${$j}_WORD_CLOUD_ANGLE`,s0=`${$j}_WORD_CLOUD_FILLING_ANGLE`,r0=`${$j}_WORD_CLOUD_WEIGHT`,a0=`${$j}_WORD_CLOUD_TEXT`;dK.useMark([FZ]),CN("wordcloud",{transform:CQ,markPhase:"beforeJoin"},!0),CN("wordcloudShape",{transform:ZQ,markPhase:"beforeJoin"},!0);class o0 extends Sq{static mark={...Sq.mark,[jK.word]:{name:jK.word,type:v$.text},[jK.fillingWord]:{name:jK.fillingWord,type:v$.text}};_nameField;_valueField;setValueField(t){c(t)&&(this._valueField=t,this.setFontSizeRange(aQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){c(t)&&c(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??oQ,this._rotateAngles=this._spec.rotateAngles??rQ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:lQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:rQ,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!hQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(o0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(o0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?a0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",HX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(PZ(TZ.wordCloud(),RZ(jK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Bh(this._option.getTheme().colorScheme,this.type);return(new zh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??FX};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new yh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=pl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:r0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:n0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:s0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:a0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?a0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:OX,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?a0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:qo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:OX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:n0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class l0 extends o0{static type=NK.wordCloud;type=NK.wordCloud}class h0 extends o0{static type=NK.wordCloud3d;type=NK.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new yh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=pl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:r0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:n0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:s0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:a0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?a0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:OX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:OX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:n0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(o0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(o0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",HX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(PZ(TZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),RZ(jK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(PZ(TZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),RZ(jK.fillingWord,this._spec)))}}const c0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=b(y*f)?y/f:null,x=b(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:x),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},d0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},u0=`${$j}_FUNNEL_TRANSFORM_RATIO`,p0=`${$j}_FUNNEL_REACH_RATIO`,g0=`${$j}_FUNNEL_HEIGHT_RATIO`,f0=`${$j}_FUNNEL_VALUE_RATIO`,m0=`${$j}_FUNNEL_LAST_VALUE_RATIO`,y0=`${$j}_FUNNEL_NEXT_VALUE_RATIO`,_0=`${$j}_FUNNEL_LAST_VALUE`,v0=`${$j}_FUNNEL_CURRENT_VALUE`,b0=`${$j}_FUNNEL_NEXT_VALUE`,x0=`${$j}_FUNNEL_TRANSFORM_LEVEL`,S0=20;class w0 extends hq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===jK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===jK.transform){const e=t?.[p0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===jK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])?t?.[n[0]]:t?.[s]}}class A0 extends FK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class k0 extends A0{static type=v$.polygon;type=k0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}dK.useMark([k0,FZ,HZ]);class M0 extends Sq{static type=NK.funnel;type=NK.funnel;_funnelMarkName=jK.funnel;_funnelMarkType=v$.polygon;_transformMarkName=jK.transform;_transformMarkType=v$.polygon;static mark={...Sq.mark,[jK.funnel]:{name:jK.funnel,type:v$.polygon},[jK.transform]:{name:jK.transform,type:v$.polygon},[jK.transformLabel]:{name:jK.transformLabel,type:v$.text},[jK.outerLabel]:{name:jK.outerLabel,type:v$.text},[jK.outerLabelLine]:{name:jK.outerLabelLine,type:v$.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",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._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;X$(this._dataSet,"funnel",c0),X$(this._dataSet,"funnelTransform",d0);const t=new No(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${$j}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new fq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:v0,asTransformRatio:u0,asReachRatio:p0,asHeightRatio:g0,asValueRatio:f0,asNextValueRatio:y0,asLastValueRatio:m0,asLastValue:_0,asNextValue:b0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:x0}})}initMark(){if(this._funnelMark=this._createMark({...M0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:DZ(this._spec.animation,this._spec.morph,RZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...M0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(M0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(M0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(M0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(M0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new w0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>c(t[this._valueField]),fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",HX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Ll(p0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",HX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",HX.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",HX.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(PZ(TZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),RZ(jK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(PZ(TZ.funnel({},t),RZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(PZ(TZ.label(),RZ(jK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[m0])/2:this._getSecondaryAxisLength(t[f0])/2,s=this._getSecondaryAxisLength(t[f0])/2):(n=this._getSecondaryAxisLength(t[f0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[y0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[x0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return c(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!c(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(v(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-S0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",HX.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",HX.Series)}}function E0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=B0(t.children,u.children,i+1,o,u,r);u.value=h(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else u.isLeaf=!0,u.value=h(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:l,flattenIndex:o}},I0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=I0(t.children,e,t,s))})),n},D0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=D0(t.children,e,t,s)),s=e(t,n,i,s)})),s},L0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:E0,slice:P0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?P0:E0)(t,e,i,n,s)}};class O0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},O0.defaultOpionts,t);const i=this.options.nodeKey,n=l(i)?i:i?ol(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?R0(this.options.aspectRatio):null!==(e=L0[this.options.splitType])&&void 0!==e?e:L0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},s=[],r=B0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(v(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(v(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}O0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const F0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class z0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];E0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),F0);const n=m(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],n)return this._layoutLabel(t,o(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},z0.defaultOpionts,t):Object.assign({},z0.defaultOpionts);const e=this.options.nodeKey,i=l(e)?e:e?ol(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+fl(this.options.center[0],t.width),n=t.y0+fl(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=m(r),l=o?r.map((t=>fl(t,s))):fl(r,s),c=m(a),d=this.options.gapRadius,u=c?a.map((t=>fl(t,s))):fl(a,s),p=Y(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return h(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:ih(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(m(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=fl(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(m(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],s=B0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=$t({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}z0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const H0=4294967296;function j0(t,e){let i,n;if(W0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function W0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function X0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function $0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function K0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function q0(t){return{_:t,next:null,prev:null}}function Z0(t,e){const i=(t=N(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];X0(s,n,r);let a,o,l,h,c,d,u,p=q0(n),g=q0(s),f=q0(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:m(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const h=[],c=B0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%H0)/H0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=l(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:e1.defaultOpionts.nodeSort;I0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)I0([u],J0(this.options.setRadius)),D0([u],Q0(this._getPadding,.5,d)),I0([u],t1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);I0([u],J0(e1.defaultOpionts.setRadius)),D0([u],Q0(hl,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&D0([u],Q0(this._getPadding,u.radius/t,d)),I0([u],t1(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}e1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const i1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):i1(t.children,e,i)))})),e},n1=(t,e={})=>{if(!t)return[];const i=[];return i1(t,i,e),i},s1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new z0(i).layout(t,{width:n,height:s})};class r1 extends hq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var a1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(a1||(a1={}));const o1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(h(s))return t;if(i.type===a1.DrillDown){return N(g$(t,s,n,"children"))}if(i.type===a1.DrillUp){const e=f$(t,s,n,"children");if(e)return N(e)}return t};class l1{pointerId;parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}parserDragEvent(){return!0}}class h1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!0)}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}}const c1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:l1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:l1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:h1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:h1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:h1}};class d1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return c1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===dn.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;X$(t,"drillFilter",o1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(h(t.datum)||h(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!m(t)||M(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:a1.DrillDown},e().reRunAllTransform(),i.emit(RX.drill,{value:{path:t,type:a1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!m(i)||M(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:a1.DrillUp},t().reRunAllTransform(),e.emit(RX.drill,{value:{path:i,type:a1.DrillUp},model:this}),i}}dK.useMark([DJ,FZ]);class u1 extends TJ{static type=NK.sunburst;type=NK.sunburst;static mark={...Sq.mark,[jK.sunburst]:{name:jK.sunburst,type:v$.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??yq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??OX,getRawData:()=>this.getRawData()}),this._startAngle=Ut(this._spec.startAngle),this._endAngle=Ut(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),X$(this._dataSet,"sunburstLayout",s1),X$(this._dataSet,"flatten",n1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[c(this._centerX)?this._centerX:this.getLayoutRect().width/2,c(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mq,operations:["max","min","values"]},{key:yq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(X$(t.dataSet,"addVChartProperty",QK),t.transform({type:"addVChartProperty",options:{beforeCall:vq,call:xq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(u1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){h(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.y+(c(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rK.STATE_NORMAL,HX.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(u1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return d(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(c(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},rK.STATE_NORMAL,HX.Series)}initTooltip(){this._tooltipHelper=new r1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(v$.arc).forEach((i=>{i.setAnimationConfig(PZ(TZ.sunburst(t,e),RZ(i.name,this._spec)))})),this.getMarksInType(v$.text).forEach((t=>{t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(m(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}j(u1,d1);const p1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new e1(i).layout(t,{width:n,height:s})};class g1 extends hq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}dK.useMark([DJ,FZ]);class f1 extends wq{static type=NK.circlePacking;type=NK.circlePacking;static mark={...Sq.mark,[jK.circlePacking]:{name:jK.circlePacking,type:v$.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??yq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??OX,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();h(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),X$(this._dataSet,"circlePackingLayout",p1),X$(this._dataSet,"flatten",n1),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{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(X$(t.dataSet,"addVChartProperty",QK),t.transform({type:"addVChartProperty",options:{beforeCall:vq,call:xq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(f1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){h(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},rK.STATE_NORMAL,HX.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(f1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rK.STATE_NORMAL,HX.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mq,operations:["max","min","values"]},{key:yq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new g1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(v$.arc).forEach((e=>{e.setAnimationConfig(PZ(TZ.circlePacking({},t),RZ(e.name,this._spec)))})),this.getMarksInType(v$.text).forEach((t=>{t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}j(f1,d1);const m1=t=>{let e=0;return t.forEach(((t,i)=>{var n;h(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=m1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function y1(t){return t.depth}function _1(t,e){return e-1-t.endDepth}const v1=(t,e)=>t.y0-e.y0,b1={left:y1,right:_1,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?W(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:y1,end:_1};class x1{constructor(t){this._ascendingSourceBreadth=(t,e)=>v1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>v1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},x1.defaultOptions,t);const e=this.options.nodeKey,i=l(e)?e:e?ol(e):null;this._getNodeKey=i,this._alignFunc=l(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):b1[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];m1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(h(s.source)||h(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&rl("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&rl("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(f(e)){const t=ct(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(v(e)){if(r=e,v(i))a=i;else if(h(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else l(e)&&v(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}h(this.options.nodeSortBy)&&s.sort(v1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(v1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new x1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},w1=(t,e)=>{if(!t||!e?.view||!m(t))return t;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 t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new x1(e),s=[];return s.push(n.layout(t,i)),s},A1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],k1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class M1 extends hq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(v(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class C1 extends FK{static type=v$.linkPath;type=C1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){XN("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(sW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),KV("linkPathGrowIn",rW),KV("linkPathGrowOut",aW),KV("linkPathUpdate",oW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}dK.useMark([OZ,C1,FZ]),CN("sankey",{transform:S1,markPhase:"beforeJoin"},!0);class T1 extends wq{static type=NK.sankey;type=NK.sankey;static mark={...zZ.mark,[jK.node]:{name:jK.node,type:v$.rect},[jK.link]:{name:jK.link,type:v$.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=$X.Node;_labelLayoutZIndex=$X.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Vt;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){X$(this._dataSet,"sankey",w1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new Ho;$$(t,"dataview",Oo),X$(t,"sankeyNodes",A1),X$(t,"addVChartProperty",QK);const e=new No(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1),this._nodesSeriesData=new fq(this._option,e);const i=new Ho;$$(i,"dataview",Oo),X$(i,"sankeyLinks",k1),X$(i,"addVChartProperty",QK);const n=new No(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1),this._linksSeriesData=new fq(this._option,n)}}initMark(){const t=this._createMark(T1.mark.node,{isSeriesMark:!0,key:LX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(T1.mark.link,{key:LX,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(T1.mark.label,{key:LX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},rK.STATE_NORMAL,HX.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},rK.STATE_NORMAL,HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rK.STATE_NORMAL,HX.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(PZ(TZ.sankeyNode(t,e),RZ(jK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(PZ(TZ.sankeyLinkPath(),RZ(jK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:IX.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:IX.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:IX.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:IX.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(N(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||N(s[r]).includes(e.source)&&N(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(N(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new M1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Bh(this._option.getTheme().colorScheme,this.type),n=new zh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const E1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new O0(e).layout(t,i)},P1=(t,e)=>{let i={},n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=n1(s);return i=pq([{latestData:r}],e),i};class R1 extends hq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class B1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,c1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return c1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:IX.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:IX.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;h(s)||Gh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){c1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){c1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){c1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){c1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:IX.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:IX.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;h(s)&&h(r)||Gh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:IX.chart},(t=>{if(!t.event)return;const{event:n}=t;Gh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:IX.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){c1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:IX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){c1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:IX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:IX.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:IX.chart,source:BX.chart},l),this._eventObj.off(n,{level:IX.chart,source:BX.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:IX.chart,source:BX.chart},l),this._eventObj.on(n,{level:IX.chart,source:BX.chart},o)}}dK.useMark([OZ,FZ]);class I1 extends wq{static type=NK.treemap;type=NK.treemap;static mark={...Sq.mark,[jK.nonLeaf]:{name:jK.nonLeaf,type:v$.rect},[jK.leaf]:{name:jK.leaf,type:v$.rect},[jK.nonLeafLabel]:{name:jK.nonLeafLabel,type:v$.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Vt;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??yq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qt),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??OX,getRawData:()=>this.getRawData()}),b(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),X$(this._dataSet,"treemap",E1),X$(this._dataSet,"flatten",n1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(X$(this._rawData.dataSet,"addVChartProperty",QK),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vq,call:xq.bind(this)}}))}_statisticRawData(){const t=`${$j}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){X$(this._dataSet,"hierarchyDimensionStatistics",P1),X$(this._dataSet,"flatten",n1);const i=new No(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 super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mq,operations:["max","min","values"]},{key:yq,operations:["values"]}])}initMark(){const t=this._createMark(I1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(I1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(I1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(I1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},rK.STATE_NORMAL,HX.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()},rK.STATE_NORMAL,HX.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rK.STATE_NORMAL,HX.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rK.STATE_NORMAL,HX.Series)}initAnimation(){this.getMarksInType(v$.rect).forEach((t=>{t.setAnimationConfig(PZ(TZ.treemap(),RZ(t.name,this._spec)))})),this.getMarksInType(v$.text).forEach((t=>{t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))}))}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 R1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(lV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(lV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}j(I1,B1),j(I1,d1),dK.useMark([wJ,OZ]);class D1 extends tQ{static type=NK.gaugePointer;type=NK.gaugePointer;static mark={...Sq.mark,[jK.pin]:{name:jK.pin,type:v$.path},[jK.pinBackground]:{name:jK.pinBackground,type:v$.path},[jK.pointer]:{name:jK.pointer,type:[v$.path,v$.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?v$.rect:v$.path}initMark(){this._pinBackgroundMark=this._createMark(D1.mark.pinBackground),this._pointerMark=this._createMark({...D1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(D1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===v$.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return c(this.radiusAxisHelper)&&c(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(PZ(TZ.circularProgress({startAngle:this._startAngle},t),RZ(jK.pointer,this._spec)))}}dK.useMark([eQ]);class L1 extends tQ{static type=NK.gauge;type=NK.gauge;static mark={...Sq.mark,[jK.segment]:{name:jK.segment,type:v$.progressArc},[jK.track]:{name:jK.track,type:v$.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=xl(this._spec.padAngle??0)}initData(){super.initData();X$(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[XX]=t[this._angleField[0]],t[YX]=e>0?i[e-1][XX]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(L1.mark.track),this._segmentMark=this._createMark(L1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(c(t[YX])?this.angleAxisHelper.dataToPosition([t[YX]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[XX]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(PZ(TZ.circularProgress({startAngle:this._startAngle},t),RZ(jK.segment,this._spec)))}}class O1 extends hq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return c(i)&&"dimension"===t&&(i.visible=!1),i}}class F1 extends YZ{static type=v$.cell;type=F1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}dK.useMark([F1,FZ]);class z1 extends wq{static type=NK.heatmap;type=NK.heatmap;static mark={...Sq.mark,[jK.cell]:{name:jK.cell,type:v$.cell},[jK.cellBackground]:{name:jK.cellBackground,type:v$.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=N(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(z1.mark.cell,{morph:DZ(this._spec.animation,this._spec.morph,RZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(z1.mark.cellBackground,{progressive:t})}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",HX.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=We(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",HX.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(PZ(TZ.heatmap(t),RZ(jK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new O1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}dK.useSeries([oJ]);class H1 extends YK{static type=VK.area;static view="singleDefault";type=VK.area;seriesType=NK.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([zZ]);class j1 extends YK{static type=VK.bar;static view="singleDefault";type=VK.bar;seriesType=NK.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([eJ]);class N1 extends YK{static type=VK.bar3d;static view="singleDefault";type=VK.bar3d;seriesType=NK.bar3d}dK.useSeries([$Z]);class V1 extends YK{static type=VK.boxPlot;static view="singleDefault";type=VK.boxPlot;seriesType=NK.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??Wh.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===Wh.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),XK(t)}}dK.useSeries([f1]);class W1 extends GK{static type=VK.circlePacking;static view="singleDefault";type=VK.circlePacking;seriesType=NK.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=NK.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class U1 extends GK{static type=VK.common;static view="singleDefault";type=VK.common}class G1 extends GK{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([M0]);class Y1 extends G1{static type=VK.funnel;static view="singleDefault";type=VK.funnel;seriesType=NK.funnel}dK.useSeries([T0]);class X1 extends G1{static type=VK.funnel3d;static view="singleDefault";type=VK.funnel3d;seriesType=NK.funnel3d}const $1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function K1(t){let e=0;return C(t,"tick.visible")&&(e+=C(t,"tick.tickSize")),C(t,"label.visible")&&(e+=C(t,"label.space")),e}function q1(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function Z1(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function J1(t){const e=t?.orient;return"angle"===e||"radius"===e}const Q1=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},T$(t)?r:a)},t2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class e2 extends GK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=N(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return c(i)&&e.forEach((t=>{h(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],c(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class i2 extends e2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),h(n.angle.type)&&(n.angle.type="linear"),h(n.radius.type)&&(n.radius.type="band");const s=q1(n.angle,{min:0,max:1});h(n.angle.min)&&(n.angle.min=s.min),h(n.angle.max)&&(n.angle.max=s.max)}}dK.useSeries([D1,L1]);class n2 extends i2{static type=VK.gauge;static view="singleDefault";type=VK.gauge;seriesType=NK.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:NK.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===NK.gauge||t.type===NK.circularProgress));h(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&h(e.radiusField)&&h(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===NK.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),h(e.angle.type)&&(e.angle.type="linear"),h(e.radius.type)&&(e.radius.type="linear")}}dK.useSeries([z1]);class s2 extends YK{static type=VK.heatmap;static view="singleDefault";type=VK.heatmap;seriesType=NK.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class r2 extends YK{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}dK.useSeries([zZ]);class a2 extends r2{static type=VK.histogram;static view="singleDefault";type=VK.histogram;seriesType=NK.bar;transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([eJ]);class o2 extends r2{static type=VK.histogram3d;static view="singleDefault";type=VK.histogram3d;seriesType=NK.bar3d}dK.useSeries([QZ]);class l2 extends YK{static type=VK.line;static view="singleDefault";type=VK.line;seriesType=NK.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([CJ]);class h2 extends GK{static type=VK.map;static view="singleDefault";type=VK.map;seriesType=NK.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area}}isValidSeries(t){return t===NK.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class c2 extends e2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}dK.useSeries([OJ]);class d2 extends c2{static type=VK.pie;static view="singleDefault";type=VK.pie;seriesType=NK.pie}dK.useSeries([zJ]);class u2 extends c2{static type=VK.pie3d;static view="singleDefault";type=VK.pie3d;seriesType=NK.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}dK.useSeries([iQ]);class p2 extends i2{static type=VK.circularProgress;static view="singleDefault";type=VK.circularProgress;seriesType=NK.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}dK.useSeries([sQ]);class g2 extends YK{static type=VK.linearProgress;static view="singleDefault";type=VK.linearProgress;seriesType=NK.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="band"),h(e.type)&&(e.type="linear");const n=q1(e,{min:0,max:1});h(e.min)&&(e.min=n.min),h(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="linear"),h(e.type)&&(e.type="band");const n=q1(i,{min:0,max:1});h(i.min)&&(i.min=n.min),h(i.max)&&(i.max=n.max)}}}class f2 extends e2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}dK.useSeries([XJ]);class m2 extends f2{static type=VK.radar;static view="singleDefault";type=VK.radar;seriesType=NK.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:L({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}dK.useSeries([hJ]);class y2 extends YK{static type=VK.rangeArea;static view="singleDefault";type=VK.rangeArea;seriesType=NK.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===Wh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([sJ]);class _2 extends YK{static type=VK.rangeColumn;static view="singleDefault";type=VK.rangeColumn;seriesType=NK.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===Wh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([rJ]);class v2 extends YK{static type=VK.rangeColumn3d;static view="singleDefault";type=VK.rangeColumn3d;seriesType=NK.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===Wh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}dK.useSeries([YJ]);class b2 extends f2{static type=VK.rose;static view="singleDefault";type=VK.rose;seriesType=NK.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??AN,outerRadius:t.outerRadius??AN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}dK.useSeries([T1]);class x2 extends GK{static type=VK.sankey;static view="singleDefault";type=VK.sankey;seriesType=NK.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([UJ]);class S2 extends YK{static type=VK.scatter;static view="singleDefault";type=VK.scatter;seriesType=NK.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}dK.useSeries([ZJ,QJ]);class w2 extends GK{static type=VK.sequence;static view="singleDefault";type=VK.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==NK.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[NK.bar,NK.line,NK.area,NK.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===NK.dot?"band":"linear",visible:t.type!==NK.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===NK.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===NK.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=eK(t.data,this._dataSet,this._spec.data),t.type===NK.link&&(t.dataDot=eK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===NK.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===NK.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=b$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}dK.useSeries([u1]);class A2 extends GK{static type=VK.sunburst;static view="singleDefault";type=VK.sunburst;seriesType=NK.sunburst;getDefaultSeriesSpec(t){const e=c(t.startAngle)?t.startAngle:SN,i=c(t.endAngle)?t.endAngle:e+Gt(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=NK.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([I1]);class k2 extends GK{static type=VK.treemap;static view="singleDefault";type=VK.treemap;seriesType=NK.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([jZ]);class M2 extends j1{static type=VK.waterfall;static view="singleDefault";type=VK.waterfall;seriesType=NK.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&N(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),XK(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class C2 extends GK{type=VK.wordCloud;seriesType=NK.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([l0]);class T2 extends C2{static type=VK.wordCloud;static view="singleDefault";type=VK.wordCloud;seriesType=NK.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}dK.useSeries([h0]);class E2 extends C2{static type=VK.wordCloud3d;static view="singleDefault";type=VK.wordCloud3d;seriesType=NK.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class P2{plugins;id=tl();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Go("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this.plugins.find((e=>e.id===t))}getAll(){return this.plugins.slice()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function R2(t){const e={...t};return M(t.style)||(e.textStyle=_$(t.style)),M(t.textStyle)||L(e.textStyle,_$(t.textStyle)),t.shape?.style&&_$(e.shape.style),t.background?.style&&_$(e.background.style),e}function B2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class I2 extends xK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new P2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new TK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case dn.cartesianBandAxis:return Q1(R$(i),"band",e);case dn.cartesianLinearAxis:return Q1(R$(i),"linear",e);case dn.cartesianAxis:case dn.cartesianTimeAxis:return Q1(R$(i),void 0,e);case dn.polarBandAxis:return t2(i.orient,"band",e);case dn.polarLinearAxis:return t2(i.orient,"linear",e);case dn.polarAxis:return t2(i.orient,void 0,e);case dn.cartesianCrosshair:case dn.polarCrosshair:return e.component?.crosshair;case dn.colorLegend:return e.component?.colorLegend[B2(i)];case dn.sizeLegend:return e.component?.sizeLegend[B2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),m(this._originalSpec)?this._spec=this._originalSpec.map((t=>L({},this._theme,t))):this._spec=L({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:BX.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const D2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(h(a)||h(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},L2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{h(i[e])||t.latestData.forEach((t=>{N(i[e]).forEach((i=>{h(t[i])||(h(o[t[i]])&&(o[t[i]]=0),h(n[e])||(o[t[i]]+=parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class O2 extends I2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else Dl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Dl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=R$(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?Wh.horizontal:Wh.vertical)===Wh.horizontal,c(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(c(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):c(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),h(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Fl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(c(t)&&(c(t.userId)&&(this._seriesUserId=N(t.userId)),c(t.specIndex)&&(this._seriesIndex=N(t.specIndex))),c(this._spec.seriesId)){const t=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(c(this._spec.seriesIndex)){const t=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(c(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(c(this._spec.regionId)){const t=N(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(Fl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];let n=!1;if(this._relatedAxisComponent){const s={};Dl(this._regions,(r=>{const a="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,o="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!a||!o)return;const l=a.getAxisId()===this._relatedAxisComponent.id?a:o.getAxisId()===this._relatedAxisComponent.id?o:this._isHorizontal?a:o,h=l===a?o:a,c=Fl(h.getScale(0).type);c&&(n=!0),t.push(r.getRawData());const d=r.getSpec(),u=N(d.xField),p=N(d.yField),g="cartesian"===r.coordinate?u[u.length-1]:d.angleField??d.categoryField,f="cartesian"===r.coordinate?p[p.length-1]:d.radiusField??d.valueField;if(s[r.id]="link"===r.type?"from_xField":l===a?g:f,e.push(s[r.id]),this._valueField){const t="link"===r.type?"from_yField":h===a?g:f;i.push(c?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else n=h(this._spec.valueField),Dl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;$$(s,"dataview",Oo),X$(s,"dataFilterComputeDomain",L2);const r=new No(s);r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:n?this._valueField:null}}},!1),this._data=new DK(this._option,r),r.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&Fl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&Fl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Fl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new rh,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(X$(this._option.dataSet,"dataFilterWithNewDomain",D2),Dl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>Fl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Fl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ct(this._start-s,0,1),a=ct(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}j(O2,B1);class F2 extends O2{static type=dn.scrollBar;type=dn.scrollBar;name=dn.scrollBar;layoutZIndex=$X.DataZoom;layoutLevel=KX.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(h(i))return;if(!m(i))return new F2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new F2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new ZW({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(RX.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return h(i)||(n.padding=i),M(t?.style)||(n.railStyle=_$(t.style)),M(e?.style)||(n.sliderStyle=_$(e.style)),n}}class z2 extends O2{static type=dn.dataZoom;type=dn.dataZoom;name=dn.dataZoom;layoutZIndex=$X.DataZoom;layoutLevel=KX.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(h(i))return;if(!m(i))return new z2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new z2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize)}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new yh;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._stateScale:this._valueScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().x+e};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?this._valueScale:this._stateScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().y+e};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new gG({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(RX.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:_$(this._spec.background?.style),startHandlerStyle:_$(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:_$(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:_$(this._spec.middleHandler.background?.style)}},endHandlerStyle:_$(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:_$(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:_$(this._spec.endText?.style)},selectedBackgroundStyle:_$(this._spec.selectedBackground.style),dragMaskStyle:_$(this._spec.dragMask?.style),backgroundChartStyle:{line:L(_$(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,..._$(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:L(_$(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,..._$(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class H2 extends I2{static type=dn.customMark;type=dn.customMark;layoutType="absolute";layoutZIndex=$X.CustomMark;layoutLevel=KX.CustomMark;static createComponent(t,e){return t.customMark?[new H2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${$j}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${$j}_${n}`});if(s&&(h(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),c(t.dataId)||b(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class j2 extends I2{layoutType="absolute";static type=dn.brush;type=dn.brush;name=dn.brush;layoutZIndex=$X.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!h(i)&&!1!==i.visible)return[new j2(i,{...e,specKey:j2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new dY({zIndex:this.layoutZIndex,brushStyle:_$(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=RX.brushChange;r="brushStart"===n||"brushDown"===n?RX.brushStart:"brushEnd"===n||"brushMaskUp"===n?RX.brushEnd:RX.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{..._$(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&De(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&Ie(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){c(this._spec.regionId)&&c(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){c(this._spec.brushLinkSeriesId)&&c(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&N(t).includes(s.userId)||e&&N(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var N2;function V2(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function W2(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function U2(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:W2(t.rect),anchorCandidates:q2(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>V2(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;tV2(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function G2(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=Re(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=$2(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=ln(r,n,i);if(!$2(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],Y2(X2(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=Y2(X2(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=K2(t.rect,a,0),t}));return U2(h)}function Y2(t){return t>180?t-360:t}function X2(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function $2(t,e){for(let i=0;i{const{x:r,y:a}=K2({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(N2||(N2={}));class Z2 extends I2{static type=dn.mapLabel;type=dn.mapLabel;name=dn.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=$X.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!c(i.series)?new Z2(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new No(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new DK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new MG({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=Kh(this._spec.background?.padding),d=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const u={},p=this.dataToPosition(t),g=rB({});if(g.name=`${this.name}_marker_itemContainer_${e}`,u.container=g,this._spec.background?.visible){const t=lB(_$({...this._spec.background.style}));t.setAttributes(p),u.labelBackground=t,g.appendChild(t)}if(this._spec.icon?.visible){const t=dB(_$({...this._spec.icon.style}));t.setAttributes(p),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;u.icon=t,g.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=cB(_$({...this._spec.nameLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.nameLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&c(t[this.valueField])){const e=cB(_$({...this._spec.valueLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.valueLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}const f=Object.values(u).find((t=>!!t&&"group"!==t.type)),m={x:f?.getComputedAttribute("x"),y:f?.getComputedAttribute("y")},y={x:m.x,y:m.y,width:0,height:0};y.width=n+r+(i-1)*d,y.height=s+a;const _={rect:y,point:m,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));_.rect=K2(y,o,l),_.anchors=t,_.offset=l}else _.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:_,contentMarks:u}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:_$({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):U2(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class J2{id;name;service;static Name;constructor(t=J2.Name){this.id=tl(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function Q2(t,e){const i=e.getSpec?.();M(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=T$(e.layoutOrient),r=t[0],a=V(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);Q2(n?n.getChildren():[],t.component),Q2(s?s.getChildren():[],t.component)}}function e3(t){return 2===t.length&&b(t[0])&&b(t[1])&&t[1]>=t[0]}function i3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!b(a.min),extendable_max:!b(a.max)}}function n3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function s3(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function r3(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function a3(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const o3=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),l3=(t,e,i=0)=>{const n=new Wt(t).expand(i/2),s=new Wt(e).expand(i/2);return n.intersects(s)},h3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function d3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=xl(-90));const u=h$(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Wt).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},p3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return o3(p,r.options)};class g3 extends J2{Name="AxisSyncPlugin";constructor(){super(g3.Name)}_checkEnableSync(t){if(!Fl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(RX.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!Fl(i.type)||!Fl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!e3(s)||!e3(r))return;const a=i3(t,s),o=i3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!s3(a,o))return}else if(0===p&&0===g){if(!s3(o,a))return}else if(u||y)if(u&&!y){if(!n3(a,o))return}else if(y&&!u){if(!n3(o,a))return}else{if(h===g)return;if(h>g){if(!r3(a,o))return}else if(!r3(o,a))return}else{if(0===h&&0===p){if(!a3(a,o))return}else if(0===g&&0===l&&!a3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){X$(e.getOption().dataSet,"tickAlign",p3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var f3={AxisLabelOverlapPlugin:t3,AxisSyncPlugin:g3};const m3=t=>t,y3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!c3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},_3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?h3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return o3(t.domain());let h;if(c(s))h=t.stepTicks(s);else if(c(n))h=t.forceTicks(n);else if(c(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=K1(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=K1(r),c=h$(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Rl(u),{x:m,y:y}=$t({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Wt).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=b3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}else h=t.domain();return o3(h)},b3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&l3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},x3=(t,e)=>{if(Fl(t.type))return((t,e)=>{if(!Fl(t.type))return o3(t.domain());const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=c(s)?t.stepTicks(s):c(n)?t.forceTicks(n):t.ticks(i??5),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=u3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&d3(s,i);)s=y3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),V(a)!==V(r)&&a.push(V(r))),r=a}return o3(r)})(t,e);if(Hl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(c(s))l=t.stepTicks(s);else if(c(n))l=t.forceTicks(n);else if(c(i))l=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=u3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=_3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}else l=t.domain();return o3(l)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return v3(t,e)}return o3(t.domain())};class S3 extends I2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),c(this._spec.id)&&t.setUserId(this._spec.id),o(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==C(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=PZ(TZ.axis(),{appear:this._spec.animationAppear??C(this._option.getChart().getSpec(),"animationAppear.axis")??C(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??C(this._option.getChart().getSpec(),"animationDisappear.axis")??C(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??C(this._option.getChart().getSpec(),"animationEnter.axis")??C(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??C(this._option.getChart().getSpec(),"animationExit.axis")??C(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??C(this._option.getChart().getSpec(),"animationUpdate.axis")??C(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return Dl(this._regions,(e=>{m(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;c(t)&&(this._seriesUserId=N(t)),c(i)&&(this._regionUserId=N(i)),c(e)&&(this._seriesIndex=N(e)),c(n)&&(this._regionIndex=N(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(Dl(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!Fl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(Dl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===$U.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&h(t.title.angle)&&(i="left"===t.orient?-90:90,e=$1[t.orient]),{orient:this.orient,select:t.select,hover:t.hover,line:(n=t.domainLine,m$(n),m$(n.startSymbol),m$(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:l(t.label.style)?(e,i)=>{const n=this._preprocessSpec(t.label.style(e.rawValue,i,e));return _$(this._preprocessSpec(L({},this._theme.label?.style,n)))}:_$(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:y$(t.label.state),autoRotate:!!t.label.autoRotate,autoHide:!!t.label.autoHide,autoLimit:!!t.label.autoLimit,autoRotateAngle:t.label.autoRotateAngle,autoHideMethod:t.label.autoHideMethod,autoHideSeparation:t.label.autoHideSeparation,limitEllipsis:t.label.limitEllipsis,layoutFunc:t.label.layoutFunc},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:l(t.tick.style)?(e,i)=>{const n=this._preprocessSpec(t.tick.style(e.rawValue,i,e));return _$(this._preprocessSpec(L({},this._theme.tick?.style,n)))}:_$(t.tick.style),state:y$(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:_$(t.subTick.style),state:y$(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:l(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return _$(this._preprocessSpec(L({},this._theme.grid?.style,n)))}:_$(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:_$(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Ut(i):null,textStyle:L({},e,_$(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:_$(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:_$(t.title.background?.style)},state:{text:y$(t.title.state),shape:y$(t.title.shape?.state),background:y$(t.title.background?.state)}},panel:{visible:t.background?.visible,style:_$(t.background?.style),state:y$(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const w3=[f3.AxisLabelOverlapPlugin,f3.AxisSyncPlugin];class A3 extends S3{static type=dn.cartesianAxis;type=dn.cartesianAxis;name=dn.cartesianAxis;layoutType="region-relative";layoutZIndex=$X.Axis;layoutLevel=KX.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;_verticalLimitSize;constructor(t,e){super(t,{...e}),this._orient=R$(t,["z"]),P$(this._orient)&&(this.layoutType="absolute"),c(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?T$(t)?"linear":"band":T$(t)?"band":"linear"}(t.orient,i),s=`${A3.type}-${n}`,r=b$.getComponentInKey(s);if(r){let n=t.inverse;return i&&!T$(t.orient)&&(n=!c(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(A3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[A3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===Wh.horizontal;if(!m(i))return Z1(i)?A3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>E$(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{Z1(t)&&a.push(A3.createAxis(t,{...e,specIndex:i,specKey:A3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),Dl(this._regions,(t=>{T$(this.orient)?t.setXAxisHelper(this.axisHelper()):E$(this.orient)?t.setYAxisHelper(this.axisHelper()):P$(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];T$(this.orient)?b(e)&&(s=n?[e,0]:[0,e]):P$(this.orient)?b(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):b(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(w3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();T$(this.orient)?h(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):h(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=T$(this.orient)?t.fieldX:P$(this.orient)?t.fieldZ:t.fieldY,Fl(this._scale.type)?e:[e[0]]}_initData(){$$(this._option.dataSet,"scale",m3),X$(this._option.dataSet,"ticks",x3);const t=this._spec.label||{},e=this._tick||{},i=new No(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new DK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(lV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(T$(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(RX.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Dl(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return Dl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:T$(this.orient)?i.fieldX:P$(this.orient)?i.fieldZ:i.fieldY,n=m(n)?Fl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Dl(this._regions,(t=>{T$(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):E$(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):P$(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;b(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),b(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=T$(this.orient)?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=T$(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(L({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=L({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&h(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=T$(this.orient),s=t=>(n?!T$(t.orient):T$(t.orient))&&Fl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(c(t))a=r.find((e=>e.id===t));else if(c(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const k3=Math.sqrt(50),M3=Math.sqrt(10),C3=Math.sqrt(2);class T3{_extend={};setExtraAttrFromSpec(){c(this._spec.nice)&&(this._nice=this._spec.nice),c(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=q1(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];c(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),c(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(W(t)-function(t){if(t&&m(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=k3?10:s>=M3?5:s>=C3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(RX.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}j(R3,P3);class B3 extends E3{static type=dn.cartesianTimeAxis;type=dn.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),Dl(this._regions,(t=>{T$(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=L({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new No(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new DK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=Vo.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return m(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&m(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class I3 extends S3{static type=dn.polarAxis;type=dn.polarAxis;name=dn.polarAxis;layoutType="absolute";layoutZIndex=$X.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=bN;get startAngle(){return this._startAngle}_endAngle=xN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${I3.type}-${i}`,s=b$.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(I3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!m(i))return J1(i)?(i.center=t.center,i.startAngle=t.startAngle??SN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:wN),I3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!J1(i))return;i.center=t.center,i.startAngle=t.startAngle??SN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:wN),i.outerRadius=i.radius??t.outerRadius??t.radius??AN;const o=I3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),Dl(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=xl(this._spec.startAngle??SN),this._endAngle=xl(this._spec.endAngle??(c(this._spec.startAngle)?this._spec.startAngle+360:wN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(RX.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){$$(this._option.dataSet,"scale",m3),X$(this._option.dataSet,"ticks",x3);const t=this._spec.label||{},e=this._spec.tick||{},i=new No(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new DK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return Dl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=m(n)?Fl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Dl(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return Fl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=wl({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=jt.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=AN,e=0;const i=this.getChart().getSpec();return Dl(this.getRegions(),(n=>{const s=n;if(function(t){return[NK.rose,NK.radar,NK.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;b(n)&&(t=n),b(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(L({},this._axisStyle,t))}}class D3 extends I3{static type=dn.polarLinearAxis;type=dn.polarLinearAxis;_zero=!0;_nice=!0;_scale=new yh;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}j(D3,T3);class L3 extends I3{static type=dn.polarBandAxis;type=dn.polarBandAxis;_scale=new rh;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function O3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:p,regionId:g,regionIndex:f,seriesIndex:m,seriesId:y,padding:_,...v}=L({},t),b=v;return i.visible&&(b.title=R2(i)),M(n.focusIconStyle)||_$(n.focusIconStyle),m$(n.shape),m$(n.label),m$(n.value),m$(n.background),Yh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),Yh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),Yh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),b.item=n,M(s.textStyle)||_$(s.textStyle),m$(s.handler),b.pager=s,r.visible&&!M(r.style)&&(L(b,r.style),c(r.padding)&&(b.padding=r.padding)),b}j(L3,P3);const F3=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},z3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return c(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class H3 extends I2{layoutType="normal";layoutZIndex=$X.Legend;layoutLevel=KX.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{Dl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Dl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Uh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;c(i)&&(this._seriesUserId=N(i)),c(t)&&(this._regionUserId=N(t)),c(n)&&(this._seriesIndex=N(n)),c(e)&&(this._regionUserIndex=N(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new DK(this._option,t),this._initSelectedData(),Dl(this._regions,(t=>{t.event.on(RX.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;h(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(RX.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;b(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(L({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(L({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class j3 extends H3{static type=dn.discreteLegend;type=dn.discreteLegend;name=dn.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return i.type&&"discrete"!==i.type?void 0:new j3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new j3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),Dl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){X$(this._option.dataSet,"discreteLegendFilter",z3),X$(this._option.dataSet,"discreteLegendDataMake",F3);const t=new No(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!il(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=p$(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...O3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return zG}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(IG.legendItemClick,(e=>{const i=C(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(RX.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(IG.legendItemHover,(t=>{const e=C(t,"detail");this.event.emit(RX.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(IG.legendItemUnHover,(t=>{const e=C(t,"detail");this.event.emit(RX.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:b(r)?r:1,strokeOpacity:b(a)?a:1,opacity:b(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return l(this._spec.data)?this._spec.data(t):t}}const N3=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;b(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},V3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!M(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function W3(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:d,id:u,visible:p,orient:g,position:f,data:m,defaultSelected:y,field:_,filter:v,regionId:b,regionIndex:x,seriesIndex:S,seriesId:w,padding:A,...k}=L({},t),C=k;return e.visible&&(C.title=R2(e)),C.showHandler=!1!==i.visible,M(i.style)||(C.handlerStyle=_$(i.style)),c(n.width)&&(C.railWidth=n.width),c(n.height)&&(C.railHeight=n.height),M(n.style)||(C.railStyle=_$(n.style)),M(s.style)||(C.trackStyle=_$(s.style)),C.startText=m$(r),C.endText=m$(a),C.handlerText=m$(o),M(l)||(C.sizeBackground=_$(l)),h.visible&&!M(h.style)&&(L(C,h.style),c(h.padding)&&(C.padding=h.padding)),C}function U3(t){return"color"===t||"size"===t}const G3={color:WG,size:GG},Y3=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],X3=[2,10];class $3 extends H3{static type=dn.continuousLegend;type=dn.colorLegend;name=dn.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return U3(i.type)?new $3(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{U3(t.type)&&n.push(new $3(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?dn.colorLegend:dn.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),Dl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){X$(this._option.dataSet,"continuousLegendFilter",V3),X$(this._option.dataSet,"continuousLegendDataMake",N3);const t=new No(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=p$(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!il(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=p$(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),M(n)&&(n="color"===this._legendType?Y3:X3);const r={...W3(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return G3[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",gt((e=>{const i=C(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(RX.legendFilter,{model:this,value:i,event:e})}),30))}}}const K3=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),N(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class q3 extends I2{static type=dn.indicator;type=dn.indicator;name=dn.indicator;layoutType="absolute";layoutZIndex=$X.Indicator;layoutLevel=KX.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==q3.type)return null;const i=N(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map((t=>new q3(t,e)));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){X$(this._option.dataSet,"indicatorFilter",K3);const t=new No(this._option.dataSet);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 DK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return N(this._spec.content).forEach((t=>{const e=L({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{..._$(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!c(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{..._$(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new $G(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":l(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return Dl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){super.clear(),this._indicatorComponent=null,this._cacheAttrs=null}}class Z3 extends I2{static type=dn.title;type=dn.title;layoutType="normal";layoutZIndex=$X.Title;layoutLevel=KX.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Uh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!m(i))return new Z3(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new Z3(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;b(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),b(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:b(t.width())?t.width():0,height:this._spec.height?this._spec.height:b(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new YG(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class J3{projection;constructor(t){if(this.projection=uJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function Q3(t,e){return`${$j}_${e}_${t}`}class t5 extends I2{static type=dn.geoCoordinate;type=dn.geoCoordinate;name=dn.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:Q3(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(h(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new t5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=L(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(RX.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new J3(this._projectionSpec)}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===NK.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===NK.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(NK.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==NK.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}j(t5,B1);const e5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},i5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class n5 extends I2{layoutType="absolute";gridZIndex=$X.CrossHair_Grid;labelZIndex=$X.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach(((t,i)=>this._registerEvent(t,m(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:BX.chart},this._handleEvent),this.event.on(e,{level:IX.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ft((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(e5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(m(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(e5[e][t]),s=s.concat(e5[e][i(t)])})),{in:n,out:s}}return{in:e5[e][t],out:e5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=C(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{i5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),m(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function r5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var a5,o5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(a5||(a5={}));class l5 extends n5{static type=dn.cartesianCrosshair;type=dn.cartesianCrosshair;name=dn.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.xField||i.yField?new l5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new l5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,a5.VERTICAL,!0),this.layoutByValue(a5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,a5.HORIZONTAL,!1),this.layoutByValue(a5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return Fl(t.getScale().type)&&b(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){T$(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{Hl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(a5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=a5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,d;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(Hl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(Fl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=r5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=K1(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(Hl(s.type)){const t=s._step;d=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(Fl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=r5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(d=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):d=1,a=r}}if(this.yHair.label?.visible){const e=K1(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(a5.HORIZONTAL&&this._layoutHorizontal(n,d??0),a5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new _U({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new vU({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new mU(e)),n.add(t)),s5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(o5||(o5={}));class h5 extends n5{static type=dn.polarCrosshair;type=dn.polarCrosshair;name=dn.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.categoryField||i.valueField?new h5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new h5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{Hl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});Fl(s.getScale().type)&&b(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:jt.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(o5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",L(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=K1(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=K1(t.getSpec())),n.angle=i.angle,n.axis=t,L(n,s)}))),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(o5.HORIZONTAL&&this._layoutHorizontal(n),o5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:$t(l,n,i),end:$t(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new _U({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new xU({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Rl(i),e={...$t(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Kt(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=$t(t,s,p),m=$t(t,s,g),y=ve([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=ct(jt.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new SU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new bU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=bl(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}}(i),n={...$t(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new mU(e),n.add(t),i(t)),s5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const c5=t=>_$({...t}),d5=t=>({...t,style:{..._$(t.style)}}),u5=t=>{const e=c5(t?.slider?.trackStyle??{}),i=c5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},_$({...s}));var s;const r=d5(t?.controller?.start??{}),a=d5(t?.controller?.pause??{}),o=d5(t?.controller?.backward??{}),l=d5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},p5=(t,e)=>({...u5(t),data:e,type:"continuous"}),g5=(t,e)=>({...u5(t),data:e,type:"discrete"}),f5=t=>"left"===t||"right"===t,m5=t=>"top"===t||"bottom"===t;class y5 extends I2{layoutZIndex=$X.Player;layoutLevel=KX.Player;static type=dn.player;type=dn.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return h(i)||!1===i.visible?null:new y5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),b(t.x)){const e=f5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(b(t.y)){const e=m5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(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}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{...g5(this._spec,this._specs),...e}:{...p5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new oY(t):this._playerComponent=new hY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 v(this._spec.width)?Math.min(t.width,Number(this._spec.width)):f5(this._orient)?this._maxSize():t.width}_computeHeight(t){return v(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):m5(this._orient)?this._maxSize():t.height}_computeDx(t){return f5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return m5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size),(f5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(f5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(RX.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(iY.OnEnd,(()=>{this.event.emit(RX.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(iY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];N(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(RX.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const _5=(t,e)=>Cl(t[0].latestData,e.field),v5=(t,e)=>Tl(t[0].latestData,e.field);function b5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function x5(t,e){return El(t[0].latestData,e.field)}function S5(t,e){return Pl(t[0].latestData,e.field)}function w5(t,e){return function(t,e){return Math.sqrt(Pl(t,e))}(t[0].latestData,e.field)}function A5(t,e){return function(t,e){return Z(t.map((t=>t[e])))}(t[0].latestData,e.field)}function k5(t,e){const i={min:_5,max:v5,sum:b5,average:x5,variance:S5,standardDeviation:w5,median:A5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(c(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(c(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function M5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.x)){v(t.x)&&E5(u,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function C5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.y)){v(t.y)&&E5(u,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function T5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();v(t.x)&&E5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),v(t.y)&&E5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function E5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const P5=["sum","average","min","max","variance","standardDeviation","median"];class R5 extends I2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||P5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??N(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(N(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Cl(t,e),r=Tl(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class I5 extends R5{static type=dn.markLine;type=dn.markLine;name=dn.markLine;layoutZIndex=$X.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new I5(i,{...e,specKey:I5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new I5(t,{...e,specIndex:i,specKey:I5.speckey}))})),n}_createMarkerComponent(){const t=new AG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:_$(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:_$(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:_$(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{..._$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{..._$(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:_$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)||c(t.coordinates)&&c(t.process)&&c(t.process.x),a=c(t.y)||c(t.coordinates)&&c(t.process)&&c(t.process.y),o=c(t.coordinates)&&(!c(t.process)||"process"in t&&"xy"in t.process),l=c(t.positions),h=t?.autoRange??!1;let d=[];r?d=M5(e,i,n,s,h)[0]:a?d=C5(e,i,n,s,h)[0]:o?d=T5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;X$(this._option.dataSet,"markerAggregation",k5),X$(this._option.dataSet,"markerRegression",B5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new No(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new No(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class D5 extends R5{static type=dn.markArea;type=dn.markArea;name=dn.markArea;layoutZIndex=$X.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new D5(i,{...e,specKey:D5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new D5(t,{...e,specIndex:i,specKey:D5.speckey}))})),n}_createMarkerComponent(){const t=new kG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:_$(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{..._$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{..._$(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:_$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)&&c(t.x1),a=c(t.y)&&c(t.y1),o=c(t.coordinates),l=c(t.positions),h=t?.autoRange??!1;let d=[],u=[];r?(u=M5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):a?(u=C5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):o?d=T5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=c(t.x)&&c(t.x1),n=c(t.y)&&c(t.y1),s=c(t.coordinates);if(!i&&!n&&!s)return null;let r;X$(this._option.dataSet,"markerAggregation",k5),X$(this._option.dataSet,"markerRegression",B5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new No(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class L5 extends R5{static type=dn.markPoint;type=dn.markPoint;name=dn.markPoint;layoutZIndex=$X.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new L5(i,{...e,specKey:L5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new L5(t,{...e,specIndex:i,specKey:L5.speckey}))})),n}_createMarkerComponent(){const t=new MG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:_$(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:_$(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{..._$(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{..._$(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:_$(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=T5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!c(t.coordinate))return;X$(this._option.dataSet,"markerAggregation",k5);const i=this._processSpecCoo(t),n=new No(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const O5=(t,e,i)=>h(t)?t:l(t)?t(e,i):t,F5=(t,e,i)=>{if(h(t))return t;if(m(t)){const n=[];return t.forEach((t=>{if(l(t)){const s=t(e,i);c(s)&&n.push(s)}else n.push(t)})),n}return l(t)?t(e,i):t};const z5=(t,e)=>(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight),H5="vchart-tooltip-container",j5=20,N5={key:"其他",value:"..."},V5={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class W5{static dom=`${$j}_TOOLTIP_HANDLER_DOM`;static canvas=`${$j}_TOOLTIP_HANDLER_CANVAS`}const U5=(t,e,i)=>{const n=O5(e.key,t,i),s=O5(e.value,t,i),r=!1!==O5(e.visible,t,i)&&(c(n)||c(s)),a=O5(e.isKeyAdaptive,t,i),o=O5(e.shapeType,t,i),l=O5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},G5=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,Y5=(t,e)=>{let i;if(c(t))if(v(t))i=t;else if(l(t)){const n=t(e);v(n)&&(i=n)}return i},X5=(t,e)=>{const i=h$(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function $5(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Tj,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var K5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(K5||(K5={}));class q5{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),K5.success):(this._updateTooltip(!1,e),K5.success)}if(h(n)||h(s))return K5.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(c(t.visible)||c(t.activeType)?s.visible=oq(t).includes("mark"):c(e.visible)||c(e.activeType)?s.visible=oq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=G5(i,"mark")??{},a=L({},R(e.mark),R(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(c))),[]);if(t.every((t=>!oq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:c(e.visible)||c(e.activeType)?s.visible=oq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=G5(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{l(t)?o.push(t):o.push(...N(t))})),r={...i[0],content:o};let d={};const u=t.filter((t=>{const e=t.tooltipHelper?.spec;return c(e?.dimension)&&oq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(u.length){let t=[];u.every((({content:t})=>h(t)))?t=void 0:u.forEach((({content:e})=>{h(e)||(l(e)?t?.push(e):t?.push(...N(e)))})),d={...u[0],content:t}}a=L({},R(e.dimension),d)}const o=r.title,d={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(c(a.title))if(l(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...d,...n}}}else a.title={...r.title,...d,...a.title};else a.title={...r.title,...d};const u=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),p=N(r.content);if(c(a.content))if(l(a.content)){const t=a.content;a.content=(e,i)=>{const n=N(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...u(p[0]),...t}})),n}}else{const t=N(a.content);t.forEach(((e,i)=>{t[i]={...u(p[0]),...e}}))}else a.content=p.map((t=>({...t,...u(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return K5.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??K5.success;const a=r[n];if(!a)return K5.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),h(o.title?.key)&&h(o.title?.value)&&!o.content?.length?K5.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??K5.success;const o=i[n];if(!o)return K5.failed;const l=this._getActualTooltipPosition(e,F5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),K5.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=v(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...V5,offsetX:t?.x??V5.offsetX,offsetY:t?.y??V5.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=F5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=F5(t.title,e,i),s=N(F5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=j5}=t,o=!1!==O5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,c(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=O5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=U5(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...N5});break}if(!(r.content.lengthh(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=U5(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...N5});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(h(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),h(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!c(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,u=this._component.getSpec(),p="canvas"===u.renderMode,g=i?.chart?.getCanvasRect(),f=g?.width??Kj,m=g?.height??qj;let y,_,v,x,S,w,A=!1;if(d(e)){const{left:t,right:i,top:n,bottom:s}=e;y=Y5(t,r),_=Y5(n,r),v=Y5(i,r),x=Y5(s,r)}else if(c(e)&&"mark"===t.activeType){A=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case C$.left:y=t-a-l,_=(i+c)/2-o/2;break;case C$.right:y=n+l,_=(i+c)/2-o/2;break;case C$.top:y=(t+n)/2-a/2,_=i-o-h;break;case C$.bottom:y=(t+n)/2-a/2,_=c+h;break;case C$.inside:y=(t+n)/2-a/2,_=(i+c)/2-o/2}}}const k={width:0,height:0},M=(t=0)=>({x:t,y:t});let C=M(),T=M(),E=1,P=1;if(qo(this._env)&&!u.confine){if(k.width=window.innerWidth,k.height=window.innerHeight,!p){T=n.getBoundingClientRect();const t=this._compiler.getCanvas()??this._chartContainer,e=t.getBoundingClientRect();C={x:e.x-T.x,y:e.y-T.y},E=z5(t,e),P=z5(n,T)}}else k.width=f,k.height=m;const{canvasX:R,canvasY:B}=r;S=b(y)?y:b(v)?f-a-v:R+l,w=b(_)?_:b(x)?m-o-x:B+h,S*=E,w*=E,qo(this._env)&&(S+=C.x,w+=C.y),S/=P,w/=P;const{width:I,height:D}=k;return(S+a)*P+T.x>I&&(A?S=(I-T.x)/P-a:S-=2*l+a),(w+o)*P+T.y>D&&(A?w=(D-T.y)/P-o:w-=2*h+o),S*P+T.x<0&&(S=0-T.x/P),w*P+T.y<0&&(w=0-T.y/P),{x:S,y:w}};_getTooltipBoxSize(t,e){return e&&!h(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:m="",hasShape:y,shapeType:_="",shapeHollow:v,shapeColor:b}=h;if(l.title.visible=f,f){const{text:t,width:e,height:i}=X5(m,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},u=e,g=i,y&&VP[_]){const t={symbolType:_};v?t.stroke=b:t.fill=b,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],h=[],d=[];l.content=t.map(((l,u)=>{const g={height:0,spaceRow:i};let f=0;const{hasShape:m,key:y,shapeColor:_,shapeHollow:v,shapeType:b="",value:x,isKeyAdaptive:S}=l;if(c(y)){const{width:t,height:e,text:i}=X5(y,a);g.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},S?h.push(t):n.push(t),f=Math.max(f,e)}if(c(x)){const{width:t,height:e,text:i}=X5(x,o);g.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},d.push(t),f=Math.max(f,e)}if(m&&VP[b]){e=!0;const t={visible:!0,symbolType:b};v?t.stroke=_:t.fill=_,f=Math.max(r.size,f),g.shape=t}else g.shape={visible:!1};return g.height=f,p+=f,uc(t)?m(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function J5(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=L({},e,t),d={};return d.fontFamily=i,d.fontSize=Z5(n),d.color=s,d.textAlign=r,d.lineHeight=Z5(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=Z5(c),d}function Q5(t,e){if(!t)return;const{size:i}=L({},e,t),n={};return n.width=Z5(i),n}class t4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===t4.type}type=t4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return t4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=Ko?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(t4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const e4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},i4={boxSizing:"border-box"},n4={display:"flex",whiteSpace:"nowrap"},s4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},r4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},a4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},o4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},l4={lineHeight:"normal"};class h4 extends t4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!VP[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=VP[e].pathStr;let o="currentColor";if(!n||f(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(d(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class c4 extends t4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class d4 extends t4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=$(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=$(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},s4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=L({},a?a4:r4,{height:Z5(i[n].height),...t.keyColumn.item});f(r)&&""!==r?.trim?.()||v(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=L({},o4,{height:Z5(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=L({},l4,{height:Z5(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class u4 extends t4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new d4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new d4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new d4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(L({},n4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class p4 extends t4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new h4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new c4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(L({},e4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class g4 extends t4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&c(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new p4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new u4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},i4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class f4 extends q5{type=W5.dom;_tooltipContainer=Ko?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(Ko&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:d,lineWidth:u=0},padding:p,key:g,value:f,title:m,shape:y,enterable:_,spaceRow:v,transitionDuration:b}=t,x=i,S={panel:{width:Z5((e?.panel?.width??0)+2*u),height:Z5((e?.panel?.height??0)+2*u),paddingBottom:Z5(p.bottom),paddingLeft:Z5(p.left),paddingRight:Z5(p.right),paddingTop:Z5(p.top),borderColor:d,borderWidth:Z5(u),borderRadius:Z5(h),backgroundColor:x?`${x}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:_?"auto":"none",transitionDuration:b?`${b}ms`:"initial",transitionProperty:b?"transform":"initial",transitionTimingFunction:b?"ease-out":"initial"},title:J5(m),content:{},shapeColumn:{item:Q5(y),width:Z5(y.size),marginRight:Z5(y.spacing??8)},keyColumn:{item:J5(g),width:Z5(e?.keyWidth),marginRight:Z5(g.spacing??26)},valueColumn:{item:J5(f),width:Z5(e?.valueWidth),marginRight:Z5(f.spacing??0)},spaceRow:Z5(v)};if(c(v)){const t=v/2;[S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((e=>{e.marginTop=Z5(t),e.marginBottom=e.marginTop})),S.content.marginTop=Z5(-t),S.content.marginBottom=S.content.marginTop}else[S.content,S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return S}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class m4 extends q5{type=W5.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new mY({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}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?c(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class y4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&c(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??K5.success:K5.failed}class _4 extends y4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![W5.dom,W5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!lq(t)&&!h(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...L$(r,a)??[],...H$(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(c(i))break}return c(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class v4 extends y4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![W5.dom,W5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const b4=t=>c(t)&&!m(t),x4=t=>c(t)&&m(t);class S4 extends I2{static type=dn.tooltip;type=dn.tooltip;name=dn.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!m(i))return new S4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new S4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?m4:f4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new v4(this),dimension:new _4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:IX.chart},this._handleMouseMove),(Zo(e)||Jo(e))&&(this._mountEvent("pointerdown",{level:IX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:IX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;qo(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||lq(t)||(n&&b4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&x4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):c(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!h(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&dK.globalConfig.uniqueTooltip&&dK.hideTooltip(a.id),r};_getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=L({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!c(t.visible)||t.visible,activeType:oq(t),renderMode:"html",trigger:c(t.trigger)?t.trigger:"hover",className:c(t.className)?t.className:"vchart-tooltip-element",enterable:!!c(t.enterable)&&t.enterable,transitionDuration:c(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=c(t.triggerOff)?t.triggerOff:this._spec.trigger,c(t.renderMode)?this._spec.renderMode=t.renderMode:Jo(this._option.mode)&&(this._spec.renderMode="canvas"),c(t.mark)&&(this._spec.mark={...R(t.mark),activeType:"mark"}),c(t.dimension)&&(this._spec.dimension={...R(t.dimension),activeType:"dimension"}),c(t.parentElement)?f(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:qo(this._option.mode)&&(this._spec.parentElement=Ko?.body),c(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=aq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:BX.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(h(this._cacheInfo)||h(t))return!1;if(x4(t)){if(b4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>S$(t,e[i])))}if(x4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(c(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(c(n)&&c(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function w4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function A4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const k4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??w4(e)};let o=!1;return f(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??A4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class M4 extends I2{static type=dn.label;type=dn.label;name=dn.label;layoutType="absolute";layoutZIndex=$X.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new M4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(RX.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(lV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(lV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Dl(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:v$.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:v$.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=k4[s.type]??k4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return L({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class C4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(b(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:l(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&c(t.modelId)){if(c(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&c(t.modelKey)&&"modelIndex"in t&&c(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>T4(t))),a=s.filter((t=>!T4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>T4(t))),h=o.filter((t=>!T4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);b(o.width)||(o.width=a.width),b(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function T4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class E4 extends PK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&T$(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&E$(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}dK.useChart([H1,l2,j1,N1,S2,h2,d2,u2,b2,m2,U1,w2,a2,o2,p2,T2,E2,Y1,X1,g2,_2,v2,A2,W1,k2,M2,V1,x2,n2,y2,s2]),dK.useComponent([E3,R3,B3,L3,D3,j3,$3,S4,l5,h5,z2,F2,q3,t5,I5,Z3,D5,y5,M4,L5,j2,H2,Z2]),b$.registerLayout("grid",C4),b$.registerLayout("layout3d",E4),t.Arc3dMark=FJ,t.ArcMark=DJ,t.AreaChart=H1,t.AreaMark=aJ,t.AreaSeries=oJ,t.Bar3dChart=N1,t.Bar3dSeries=eJ,t.BarChart=j1,t.BarSeries=zZ,t.BaseChart=GK,t.BaseMark=FK,t.BaseSeries=Sq,t.BoxPlotChart=V1,t.BoxPlotMark=GZ,t.BoxPlotSeries=$Z,t.Brush=j2,t.CartesianAxis=A3,t.CartesianBandAxis=R3,t.CartesianChart=YK,t.CartesianCrossHair=l5,t.CartesianLinearAxis=E3,t.CartesianSeries=wq,t.CartesianTimeAxis=B3,t.CellMark=F1,t.CirclePackingChart=W1,t.CirclePackingSeries=f1,t.CircularProgressChart=p2,t.CircularProgressSeries=iQ,t.CommonChart=U1,t.ComponentMark=HK,t.ContinuousLegend=$3,t.CustomMark=H2,t.DataZoom=z2,t.DiscreteLegend=j3,t.DotSeries=ZJ,t.Factory=b$,t.Funnel3dChart=X1,t.Funnel3dSeries=T0,t.FunnelChart=Y1,t.FunnelSeries=M0,t.GaugeChart=n2,t.GaugePointerSeries=D1,t.GaugeSeries=L1,t.GeoCoordinate=t5,t.GridLayout=C4,t.GroupMark=zK,t.HeatmapChart=s2,t.HeatmapSeries=z1,t.Histogram3dChart=o2,t.HistogramChart=a2,t.Indicator=q3,t.Label=M4,t.Layout=PK,t.Layout3d=E4,t.LineChart=l2,t.LineMark=JZ,t.LineSeries=QZ,t.LinearProgressChart=g2,t.LinearProgressSeries=sQ,t.LinkPathMark=C1,t.LinkSeries=QJ,t.MapChart=h2,t.MapLabelComponent=Z2,t.MapSeries=CJ,t.MarkArea=D5,t.MarkLine=I5,t.MarkPoint=L5,t.PathMark=wJ,t.Pie3dChart=u2,t.Pie3dSeries=zJ,t.PieChart=d2,t.PieSeries=OJ,t.Player=y5,t.PolarAxis=I3,t.PolarBandAxis=L3,t.PolarChart=e2,t.PolarCrossHair=h5,t.PolarLinearAxis=D3,t.PolarSeries=TJ,t.PolygonMark=k0,t.ProgressArcMark=eQ,t.ProgressLikeChart=i2,t.ProgressLikeSeries=tQ,t.Pyramid3dMark=C0,t.RadarChart=m2,t.RadarSeries=XJ,t.RangeAreaChart=y2,t.RangeAreaSeries=hJ,t.RangeColumn3dChart=v2,t.RangeColumn3dSeries=rJ,t.RangeColumnChart=_2,t.RangeColumnSeries=sJ,t.Rect3dMark=tJ,t.RectMark=OZ,t.RoseChart=b2,t.RoseLikeChart=f2,t.RoseLikeSeries=GJ,t.RoseSeries=YJ,t.RuleMark=HZ,t.SankeyChart=x2,t.SankeySeries=T1,t.ScatterChart=S2,t.ScatterSeries=UJ,t.ScrollBar=F2,t.SequenceChart=w2,t.SunburstChart=A2,t.SunburstSeries=u1,t.SymbolMark=XZ,t.TextMark=FZ,t.ThemeManager=l$,t.Title=Z3,t.Tooltip=S4,t.TreeMapChart=k2,t.TreeMapSeries=I1,t.VChart=dK,t.WaterfallChart=M2,t.WaterfallSeries=jZ,t.WordCloud3dChart=E2,t.WordCloud3dSeries=h0,t.WordCloudChart=T2,t.WordCloudSeries=l0,t.default=dK,t.version="1.1.0-beta.9",Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index 0c941ad5c2..c688a70fae 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "1.1.0-beta.8", + "version": "1.1.0-beta.9", "description": "VChart 飞书小程序组件", "main": "index.js", "files": [ diff --git a/packages/lark-vchart/src/vchart/index.js b/packages/lark-vchart/src/vchart/index.js index c3527f7260..95d2b6d2e1 100644 --- a/packages/lark-vchart/src/vchart/index.js +++ b/packages/lark-vchart/src/vchart/index.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";const e=t=>t;var i,n;t.RenderModeEnum=void 0,(i=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",i["mobile-browser"]="mobile-browser",i.node="node",i.worker="worker",i.miniApp="miniApp",i["desktop-miniApp"]="desktop-miniApp",i.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.customMark="customMark"}(n||(n={}));for(let t=0;t<256;t++)t.toString(16);const s=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};class r{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let i=0;for(let n=0;n0){for(r=t[--s];s>0&&(e=r,i=t[--s],r=e+i,n=i-(r-e),!n););s>0&&(n<0&&t[s-1]<0||n>0&&t[s-1]>0)&&(i=2*n,e=r+i,i==e-r&&(r=e))}return r}}function a(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}var o=1e-6,l=1e-12,h=Math.PI,c=h/2,d=h/4,u=2*h,p=180/h,g=h/180,f=Math.abs,m=Math.atan,y=Math.atan2,_=Math.cos,v=Math.exp,b=Math.log,x=Math.pow,S=Math.sin,w=Math.sign||function(t){return t>0?1:t<0?-1:0},A=Math.sqrt,k=Math.tan;function M(t){return t>1?0:t<-1?h:Math.acos(t)}function C(t){return t>1?c:t<-1?-c:Math.asin(t)}function T(){}function E(t,e){t&&P.hasOwnProperty(t.type)&&P[t.type](t,e)}var R={Feature:function(t,e){E(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nh&&(t-=Math.round(t/u)*u),[t,e]}function U(t,e,i){return(t%=u)?e||i?V(Y(t),$(e,i)):Y(t):e||i?$(e,i):W}function G(t){return function(e,i){return f(e+=t)>h&&(e-=Math.round(e/u)*u),[e,i]}}function Y(t){var e=G(t);return e.invert=G(-t),e}function $(t,e){var i=_(t),n=S(t),s=_(e),r=S(e);function a(t,e){var a=_(e),o=_(t)*a,l=S(t)*a,h=S(e),c=h*i+o*n;return[y(l*s-c*r,o*i-h*n),C(c*s+l*r)]}return a.invert=function(t,e){var a=_(e),o=_(t)*a,l=S(t)*a,h=S(e),c=h*s-l*r;return[y(l*s+h*r,o*i+c*n),C(c*i-o*n)]},a}function X(t,e){(e=O(e))[0]-=t,N(e);var i=M(-e[1]);return((-e[2]<0?-i:i)+u-o)%u}function K(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:T,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function q(t,e){return f(t[0]-e[0])=0;--r)s.point((d=c[r])[0],d[1]);else n(p.x,p.p.x,-1,s);p=p.p}c=(p=p.o).z,g=!g}while(!p.v);s.lineEnd()}}}function Q(t){if(e=t.length){for(var e,i,n=0,s=t[0];++n=0?1:-1,H=F*L,j=H>h,V=M*I;if(f.add(y(V*F*S(H),T*D+V*_(H))),p+=j?L+F*u:L,j^A>=i^P>=i){var W=z(O(w),O(R));N(W);var U=z(a,W);N(U);var G=(j^L>=0?-1:1)*C(U[2]);(n>G||n===G&&(W[0]||W[1]))&&(g+=j^L>=0?1:-1)}}return(p<-o||p0){for(x||(s.polygonStart(),x=!0),s.lineStart(),t=0;t1&&2&r&&a.push(a.pop().concat(a.shift())),g.push(a.filter(nt))}return w}}function nt(t){return t.length>1}function st(t,e){return((t=t.x)[0]<0?t[1]-c-o:c-t[1])-((e=e.x)[0]<0?e[1]-c-o:c-e[1])}W.invert=W;var rt=it((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var l=r>0?h:-h,d=f(r-i);f(d-h)0?c:-c),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(r,n),e=0):s!==l&&d>=h&&(f(i-s)o?m((S(e)*(r=_(n))*S(i)-S(n)*(s=_(e))*S(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(l,n),e=0),t.point(i=r,n=a),s=l},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*c,n.point(-h,s),n.point(0,s),n.point(h,s),n.point(h,0),n.point(h,-s),n.point(0,-s),n.point(-h,-s),n.point(-h,0),n.point(-h,s);else if(f(t[0]-e[0])>o){var r=t[0]0,s=f(e)>o;function r(t,i){return _(t)*_(i)>e}function a(t,i,n){var s=[1,0,0],r=z(O(t),O(i)),a=F(r,r),l=r[0],c=a-l*l;if(!c)return!n&&t;var d=e*a/c,u=-e*l/c,p=z(s,r),g=j(s,d);H(g,j(r,u));var m=p,y=F(g,m),_=F(m,m),v=y*y-_*(F(g,g)-1);if(!(v<0)){var b=A(v),x=j(m,(-y-b)/_);if(H(x,g),x=L(x),!n)return x;var S,w=t[0],k=i[0],M=t[1],C=i[1];k0^x[1]<(f(x[0]-w)h^(w<=x[0]&&x[0]<=k)){var R=j(m,(-y+b)/_);return H(R,g),[x,L(R)]}}}function l(e,i){var s=n?t:h-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return it(r,(function(t){var e,i,o,c,d;return{lineStart:function(){c=o=!1,d=1},point:function(u,p){var g,f=[u,p],m=r(u,p),y=n?m?0:l(u,p):m?l(u+(u<0?h:-h),p):0;if(!e&&(c=o=m)&&t.lineStart(),m!==o&&(!(g=a(e,f))||q(e,g)||q(f,g))&&(f[2]=1),m!==o)d=0,m?(t.lineStart(),g=a(f,e),t.point(g[0],g[1])):(g=a(e,f),t.point(g[0],g[1],2),t.lineEnd()),e=g;else if(s&&e&&n^m){var _;y&i||!(_=a(f,e,!0))||(d=0,n?(t.lineStart(),t.point(_[0][0],_[0][1]),t.point(_[1][0],_[1][1]),t.lineEnd()):(t.point(_[1][0],_[1][1]),t.lineEnd(),t.lineStart(),t.point(_[0][0],_[0][1],3)))}!m||e&&q(e,f)||t.point(f[0],f[1]),e=f,o=m,i=y},lineEnd:function(){o&&t.lineEnd(),e=null},clean:function(){return d|(c&&o)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=_(e),o=S(e),l=n*i;null==s?(s=e+n*u,r=e-l/2):(s=X(a,s),r=X(a,r),(n>0?sr)&&(s+=n*u));for(var h,c=s;n>0?c>r:c0)do{o.point(0===h||3===h?t:i,h>1?n:e)}while((h=(h+a+4)%4)!==d);else o.point(r[0],r[1])}function l(n,s){return f(n[0]-t)0?0:3:f(n[0]-i)0?2:1:f(n[1]-e)0?1:0:s>0?3:2}function h(t,e){return c(t.x,e.x)}function c(t,e){var i=l(t,1),n=l(e,1);return i!==n?i-n:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(o){var l,c,d,u,p,g,f,m,y,_,v,b=o,x=K(),S={point:w,lineStart:function(){S.point=A,c&&c.push(d=[]);_=!0,y=!1,f=m=NaN},lineEnd:function(){l&&(A(u,p),g&&y&&x.rejoin(),l.push(x.result()));S.point=w,y&&b.lineEnd()},polygonStart:function(){b=x,l=[],c=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=c.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=v&&e,s=(l=a(l)).length;(i||s)&&(o.polygonStart(),i&&(o.lineStart(),r(null,null,1,o),o.lineEnd()),s&&J(l,h,e,r,o),o.polygonEnd());b=o,l=c=d=null}};function w(t,e){s(t,e)&&b.point(t,e)}function A(r,a){var o=s(r,a);if(c&&d.push([r,a]),_)u=r,p=a,g=o,_=!1,o&&(b.lineStart(),b.point(r,a));else if(o&&y)b.point(r,a);else{var l=[f=Math.max(lt,Math.min(ot,f)),m=Math.max(lt,Math.min(ot,m))],h=[r=Math.max(lt,Math.min(ot,r)),a=Math.max(lt,Math.min(ot,a))];!function(t,e,i,n,s,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=s-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,h,t,e,i,n)?o&&(b.lineStart(),b.point(r,a),v=!1):(y||(b.lineStart(),b.point(l[0],l[1])),b.point(h[0],h[1]),o||b.lineEnd(),v=!1)}f=r,m=a,y=o}return S}}var ct,dt,ut,pt,gt=t=>t,ft=new r,mt=new r,yt={point:T,lineStart:T,lineEnd:T,polygonStart:function(){yt.lineStart=_t,yt.lineEnd=xt},polygonEnd:function(){yt.lineStart=yt.lineEnd=yt.point=T,ft.add(f(mt)),mt=new r},result:function(){var t=ft/2;return ft=new r,t}};function _t(){yt.point=vt}function vt(t,e){yt.point=bt,ct=ut=t,dt=pt=e}function bt(t,e){mt.add(pt*t-ut*e),ut=t,pt=e}function xt(){bt(ct,dt)}var St=yt,wt=1/0,At=wt,kt=-wt,Mt=kt,Ct={point:function(t,e){tkt&&(kt=t);eMt&&(Mt=e)},lineStart:T,lineEnd:T,polygonStart:T,polygonEnd:T,result:function(){var t=[[wt,At],[kt,Mt]];return kt=Mt=-(At=wt=1/0),t}};var Tt,Et,Rt,Pt,Bt=Ct,It=0,Dt=0,Lt=0,Ot=0,Ft=0,zt=0,Ht=0,jt=0,Nt=0,Vt={point:Wt,lineStart:Ut,lineEnd:$t,polygonStart:function(){Vt.lineStart=Xt,Vt.lineEnd=Kt},polygonEnd:function(){Vt.point=Wt,Vt.lineStart=Ut,Vt.lineEnd=$t},result:function(){var t=Nt?[Ht/Nt,jt/Nt]:zt?[Ot/zt,Ft/zt]:Lt?[It/Lt,Dt/Lt]:[NaN,NaN];return It=Dt=Lt=Ot=Ft=zt=Ht=jt=Nt=0,t}};function Wt(t,e){It+=t,Dt+=e,++Lt}function Ut(){Vt.point=Gt}function Gt(t,e){Vt.point=Yt,Wt(Rt=t,Pt=e)}function Yt(t,e){var i=t-Rt,n=e-Pt,s=A(i*i+n*n);Ot+=s*(Rt+t)/2,Ft+=s*(Pt+e)/2,zt+=s,Wt(Rt=t,Pt=e)}function $t(){Vt.point=Wt}function Xt(){Vt.point=qt}function Kt(){Zt(Tt,Et)}function qt(t,e){Vt.point=Zt,Wt(Tt=Rt=t,Et=Pt=e)}function Zt(t,e){var i=t-Rt,n=e-Pt,s=A(i*i+n*n);Ot+=s*(Rt+t)/2,Ft+=s*(Pt+e)/2,zt+=s,Ht+=(s=Pt*t-Rt*e)*(Rt+t),jt+=s*(Pt+e),Nt+=3*s,Wt(Rt=t,Pt=e)}var Jt=Vt;function Qt(t){this._context=t}Qt.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,u)}},result:T};var te,ee,ie,ne,se,re=new r,ae={point:T,lineStart:function(){ae.point=oe},lineEnd:function(){te&&le(ee,ie),ae.point=T},polygonStart:function(){te=!0},polygonEnd:function(){te=null},result:function(){var t=+re;return re=new r,t}};function oe(t,e){ae.point=le,ee=ne=t,ie=se=e}function le(t,e){ne-=t,se-=e,re.add(A(ne*ne+se*se)),ne=t,se=e}var he=ae;let ce,de,ue,pe;class ge{constructor(t){this._append=null==t?fe:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return fe;if(e!==ce){const t=10**e;ce=e,de=function(e){let i=1;this._+=e[0];for(const n=e.length;i=0))throw new RangeError(`invalid digits: ${t}`);s=e}return null===e&&(n=new ge(s)),a},a.projection(t).digits(s).context(e)}function ye(t){return function(e){var i=new _e;for(var n in t)i[n]=t[n];return i.stream=e,i}}function _e(){}function ve(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),D(i,t.stream(Bt)),e(Bt.result()),null!=n&&t.clipExtent(n),t}function be(t,e,i){return ve(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function xe(t,e,i){return be(t,[[0,0],e],i)}function Se(t,e,i){return ve(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function we(t,e,i){return ve(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}_e.prototype={constructor:_e,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Ae=16,ke=_(30*g);function Me(t,e){return+e?function(t,e){function i(n,s,r,a,l,h,c,d,u,p,g,m,_,v){var b=c-n,x=d-s,S=b*b+x*x;if(S>4*e&&_--){var w=a+p,k=l+g,M=h+m,T=A(w*w+k*k+M*M),E=C(M/=T),R=f(f(M)-1)e||f((b*D+x*L)/S-.5)>.3||a*p+l*g+h*m2?t[2]%360*g:0,B()):[_*p,v*p,b*p]},R.angle=function(t){return arguments.length?(x=t%360*g,B()):x*p},R.reflectX=function(t){return arguments.length?(S=t?-1:1,B()):S<0},R.reflectY=function(t){return arguments.length?(w=t?-1:1,B()):w<0},R.precision=function(t){return arguments.length?(a=Me(o,E=t*t),I()):A(E)},R.fitExtent=function(t,e){return be(R,t,e)},R.fitSize=function(t,e){return xe(R,t,e)},R.fitWidth=function(t,e){return Se(R,t,e)},R.fitHeight=function(t,e){return we(R,t,e)},function(){return e=t.apply(this,arguments),R.invert=e.invert&&P,B()}}function Pe(t){var e=0,i=h/3,n=Re(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*g,i=t[1]*g):[e*p,i*p]},s}function Be(t,e){var i=S(t),n=(i+S(e))/2;if(f(n)2?t[2]*g:0),e.invert=function(e){return(e=t.invert(e[0]*g,e[1]*g))[0]*=p,e[1]*=p,e},e}(s.rotate()).invert([0,0]));return l(null==c?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===He?[[Math.max(o[0]-r,c),e],[Math.min(o[0]+r,i),n]]:[[c,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),d()):a()},s.translate=function(t){return arguments.length?(o(t),d()):o()},s.center=function(t){return arguments.length?(r(t),d()):r()},s.clipExtent=function(t){return arguments.length?(null==t?c=e=i=n=null:(c=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),d()):null==c?null:[[c,e],[i,n]]},d()}function Ve(t){return k((c+t)/2)}function We(t,e){var i=_(t),n=t===e?S(t):b(i/_(e))/b(Ve(e)/Ve(t)),s=i*x(Ve(t),n)/n;if(!n)return He;function r(t,e){s>0?e<-c+o&&(e=-c+o):e>c-o&&(e=c-o);var i=s/x(Ve(e),n);return[i*S(n*t),s-i*_(n*t)]}return r.invert=function(t,e){var i=s-e,r=w(n)*A(t*t+i*i),a=y(t,f(i))*w(i);return i*n<0&&(a-=h*w(t)*w(i)),[a/n,2*m(x(s/r,1/n))-c]},r}function Ue(t,e){return[t,e]}function Ge(t,e){var i=_(t),n=t===e?S(t):(i-_(e))/(e-t),s=i/n+t;if(f(n)o&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ti.invert=Oe(C),ei.invert=Oe((function(t){return 2*m(t)})),ii.invert=function(t,e){return[-e,2*m(v(t))-c]},je().translate([0,0]).center([0,0]).scale(63781);var ni="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function si(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ri(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var ai=Object.prototype.hasOwnProperty;function oi(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^di[2]^di[3])}function pi(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=oi(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return ui(r[t])}function S(t,e){return li(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=mi(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ci(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Ti(t,e)}))}:Ti(t,e)}function Ti(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=Ei(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function Ei(t,e){var i=ki(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function Ii(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Mi(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=Di(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=ji(t.slice(0,n),e),o=ji(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Ni=ji;!function(t){var e=Ni;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;rObject.prototype.toString.call(t)===`[object ${e}]`,Yi=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||Gi(t,"Boolean")},$i=t=>"function"==typeof t,Xi=t=>null==t,Ki=t=>null!=t,qi=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},Zi=t=>"object"==typeof t&&null!==t,Ji=function(t){if(!Zi(t)||!Gi(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},Qi=t=>void 0===t,tn=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||Gi(t,"String")},en=t=>Array.isArray?Array.isArray(t):Gi(t,"Array"),nn=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},sn=t=>Gi(t,"Date"),rn=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||Gi(t,"Number")},an=t=>rn(t)&&Number.isFinite(t),on=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),ln=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),hn=Object.prototype,cn=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||hn)},dn=Object.prototype.hasOwnProperty;function un(t){if(Xi(t))return!0;if(nn(t))return!t.length;const e=ln(t);if("Map"===e||"Set"===e)return!t.size;if(cn(t))return!Object.keys(t).length;for(const e in t)if(dn.call(t,e))return!1;return!0}const pn=(t,e,i)=>{const n=tn(e)?e.split("."):e;for(let e=0;enull!=t&&gn.call(t,e);function mn(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(en(i)?o=[]:Gi(i,"RegExp")?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=sn(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)}function yn(t){let e;if(!Ki(t)||"object"!=typeof t)return t;const i=en(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:Yi(t)||rn(t)||tn(t)?t:sn(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=yn(n)}return e}function _n(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(Ki(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];Ki(n[r])&&"object"==typeof n[r]?vn(t,e,r,i):bn(t,r,n[r])}}}}function vn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(en(r)){if(n)a=[];else if(en(s))a=s;else if(nn(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!An(t[i],e[i]))return!1;return!0}if(!Ji(t))return!1;const i=wn(t),n=wn(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!An(t[s],e[s]))return!1}return!0}function kn(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function Rn(t,e){if(!en(t)||!en(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Bn(t,e,i){Ki(e)||(e=t,t=0),Ki(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function Dn(t){return Number(t)}function Ln(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Dn;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function On(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(Xi(n)&&(n=t.length);i>>1;In(t[s],e)>0?n=s:i=s+1}return i}const Fn=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(In)),Ln(i,.5)},zn=Math.sqrt(50),Hn=Math.sqrt(10),jn=Math.sqrt(2);function Nn(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=zn?s*=10:r>=Hn?s*=5:r>=jn&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:Vn,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wn)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function Gn(t,e,i,n){return t>e&&!Un(t,e,i,n)}function Yn(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},Xn=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?$n(n,r)+s:"center"===i?$n(n,Math.floor(r/2))+s+$n(n,Math.ceil(r/2)):s+$n(n,r)},Kn=function(t,e,i){return ti?i:t},qn=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function Zn(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let Jn=!1;try{Jn="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){Jn=!1}function Qn(t,e,i){let n,s,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&Jn;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function m(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(m(t))return _(t);o=f(y,function(t){const i=t-h,n=e-(t-l);return d?Math.min(n,r-i):n}(t))}function _(t){return o=void 0,u&&n?g(t):(n=s=void 0,a)}function v(){const t=Date.now(),i=m(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function is(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}Jn=!1;const ns=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ss=new RegExp(ns.source,"g");const rs=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function as(t){if(t instanceof Date)return t;if(tn(t)){const e=rs.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return Xi(t)?new Date(NaN):new Date(Math.round(t))}const os=1e-12,ls=Math.PI,hs=ls/2,cs=2*ls,ds=2*Math.PI,us=Math.abs,ps=Math.atan2,gs=Math.cos,fs=Math.max,ms=Math.min,ys=Math.sin,_s=Math.sqrt,vs=Math.pow;function bs(t){return t>1?0:t<-1?ls:Math.acos(t)}function xs(t){return t>=1?hs:t<=-1?-hs:Math.asin(t)}function Ss(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function ws(t,e){return t[0]*e[1]-t[1]*e[0]}class As{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new As(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return rn(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return rn(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ks{static distancePP(t,e){return _s(vs(t.x-e.x,2)+vs(t.y-e.y,2))}static distanceNN(t,e,i,n){return _s(vs(t-i,2)+vs(e-n,2))}static distancePN(t,e,i){return _s(vs(e-t.x,2)+vs(i-t.y,2))}static pointAtPP(t,e,i){return new As((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Ms(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Cs{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Cs(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return en(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ms(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class Ts extends Cs{}function Es(t){return t*(Math.PI/180)}function Rs(t){return 180*t/Math.PI}const Ps=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-cs;)t+=cs;else if(t>0)for(;t>cs;)t-=cs;return t},Bs=Ps;function Is(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Ds(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class Ls{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new Ls,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ls;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ls(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=Rs(r.rotateDeg),r}}function Os(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Fs(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const zs=/^#([0-9a-f]{3,8})$/,Hs={transparent:4294967040},js={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ns(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Vs(t){return rn(t)?new Us(t>>16,t>>8&255,255&t,1):en(t)?new Us(t[0],t[1],t[2]):new Us(255,255,255)}let Ws=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(Ki(Hs[t]))return function(t){return rn(t)?new Us(t>>>24,t>>>16&255,t>>>8&255,255&t):en(t)?new Us(t[0],t[1],t[2],t[3]):new Us(255,255,255,1)}(Hs[t]);if(Ki(js[t]))return Vs(js[t]);const e=`${t}`.trim().toLowerCase(),i=zs.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Us((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Vs(t):8===e?new Us(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Us(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Os(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Us(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new Us(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Fs(this.color.r,this.color.g,this.color.b),r=Os(Xi(t)?s.h:Kn(t,0,360),Xi(e)?s.s:e>=0&&e<=1?100*e:e,Xi(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new Us(r.r,r.g,r.b,n),this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}};class Us{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),Ki(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${Ns(this.r)+Ns(this.g)+Ns(this.b)+(1===this.opacity?"":Ns(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Fs(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Gs(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new Us(e,c,d,l*(1-t)+h*t)}},rgbToHex:Ys,rgbToHsl:Fs});function Xs(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Ks,qs,Zs,Js,Qs,tr,er,ir;function nr(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}var rr;function ar(t,e,i){return!(t&&e&&(i?(Ks=t.x1,qs=t.x2,Zs=t.y1,Js=t.y2,Qs=e.x1,tr=e.x2,er=e.y1,ir=e.y2,Ks>qs&&([Ks,qs]=[qs,Ks]),Zs>Js&&([Zs,Js]=[Js,Zs]),Qs>tr&&([Qs,tr]=[tr,Qs]),er>ir&&([er,ir]=[ir,er]),Ks>tr||qsir||Jse.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function hr(t){return t/180*Math.PI}function cr(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function dr(t,e){const i=e?t.angle:hr(t.angle),n=cr(t);return[lr({x:t.x1,y:t.y1},i,n),lr({x:t.x2,y:t.y1},i,n),lr({x:t.x2,y:t.y2},i,n),lr({x:t.x1,y:t.y2},i,n)]}let ur,pr,gr,fr;function mr(t){return ur=1/0,pr=1/0,gr=-1/0,fr=-1/0,t.forEach((t=>{ur>t.x&&(ur=t.x),grt.y&&(pr=t.y),fre&&r>n||rs?o:0}function xr(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class wr{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),Ki(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=Ki(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(Xi(this._canvas)&&(Ki(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),Xi(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&Ki(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),Xi(this._context)&&Ki(this._canvas)){const t=this._canvas.getContext("2d");Ki(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!Xi(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(Xi(t))return{width:0,height:0};if(Xi(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(Xi(this._numberCharSize)){const t=this._standardMethod(wr.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/wr.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return Xi(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(wr.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(Xi(this._letterCharSize)){const t=this._standardMethod(wr.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/wr.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return Ki(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){Ki(this._canvas)&&(this._canvas=null),Ki(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}wr.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",wr.NUMBERS_CHAR_SET="0123456789",wr.FULL_SIZE_CHAR="字";const Ar="undefined"!=typeof console;function kr(t,e,i){const n=[e].concat([].slice.call(i));Ar&&console[t].apply(console,n)}var Mr;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(Mr||(Mr={}));let Cr=class t{static getInstance(e,i){return t._instance&&rn(e)?t._instance.level(e):t._instance||(t._instance=new t(e,i)),t._instance}static setInstance(e){return t._instance=e}static setInstanceLevel(e){t._instance?t._instance.level(e):t._instance=new t(e)}static clearInstance(){t._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mr.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Mr.Info}canLogDebug(){return this._level>=Mr.Debug}canLogError(){return this._level>=Mr.Error}canLogWarn(){return this._level>=Mr.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Mr.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):kr(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Mr.Warn&&kr(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Mr.Info&&kr(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Mr.Debug&&kr(this._method||"log","DEBUG",e),this}};function Tr(t){if(an(t))return[t,t,t,t];if(en(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(qi(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Er(t){return t?"getUTCFullYear":"getFullYear"}function Rr(t){return t?"getUTCMonth":"getMonth"}function Pr(t){return t?"getUTCDate":"getDate"}function Br(t){return t?"getUTCHours":"getHours"}function Ir(t){return t?"getUTCMinutes":"getMinutes"}function Dr(t){return t?"getUTCSeconds":"getSeconds"}function Lr(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Or(t){return t?"setUTCFullYear":"setFullYear"}Cr._instance=null;const Fr=1e3,zr=6e4,Hr=36e5,jr=24*Hr,Nr=31*jr,Vr=365*jr,Wr=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),Ur=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),Gr=(t,e)=>e.getFullYear()-t.getFullYear(),Yr=t=>t.getFullYear(),$r=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),Xr=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),Kr=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),qr=t=>t.getUTCFullYear(),Zr=t=>(t.setDate(1),t.setHours(0,0,0,0),t),Jr=(t,e)=>(t.setMonth(t.getMonth()+e),t),Qr=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),ta=t=>t.getMonth(),ea=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),ia=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),na=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),sa=t=>t.getUTCMonth(),ra=t=>(t.setHours(0,0,0,0),t),aa=(t,e)=>(t.setDate(t.getDate()+e),t),oa=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/jr,la=t=>t.getDate()-1,ha=t=>(t.setUTCHours(0,0,0,0),t),ca=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),da=(t,e)=>(+e-+t)/jr,ua=t=>t.getUTCDate()-1,pa=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),ga=(t,e)=>(t.setHours(t.getHours()+e),t),fa=(t,e)=>(+e-+t)/Hr,ma=t=>t.getHours(),ya=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),_a=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),va=t=>t.getUTCHours(),ba=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),xa=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Sa=(t,e)=>(+e-+t)/6e4,wa=t=>t.getMinutes(),Aa=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),ka=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Ma=t=>t.getUTCMinutes(),Ca=t=>(t.setTime(+t-t.getMilliseconds()),t),Ta=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ea=(t,e)=>(+e-+t)/1e3,Ra=t=>t.getSeconds(),Pa=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),Ba=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ia=t=>t.getUTCSeconds(),Da=t=>t,La=(t,e)=>(t.setTime(+t+e),t),Oa=(t,e)=>+e-+t,Fa=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},za=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Fa(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Fa(h,c)}};function Ha(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function ja(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var Na=6371008.8,Va={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*Na,kilometers:6371.0088,kilometres:6371.0088,meters:Na,metres:Na,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Na/1852,radians:1,yards:6967335.223679999};function Wa(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function Ua(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function Ga(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(Ks=e.x1,qs=e.x2,Zs=e.y1,Js=e.y2,Ks>qs&&([Ks,qs]=[qs,Ks]),Zs>Js&&([Zs,Js]=[Js,Zs]),t.x>=Ks&&t.x<=qs&&t.y>=Zs&&t.y<=Js):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function Ya(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Es(t[0]),r=Es(t[1]),a=Es(i),o=function(t,e){void 0===e&&(e="kilometers");var i=Va[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Rs(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Rs(l)}}const $a=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n{const i=$a(qa,e),{tolerance:n}=i;return Vi(t,n)};var Ja;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Ja||(Ja={}));const Qa=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},to=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+ro(e,6):ro(e,4))+"-"+ro(t.getUTCMonth()+1,2)+"-"+ro(t.getUTCDate(),2)+(r?"T"+ro(i,2)+":"+ro(n,2)+":"+ro(s,2)+"."+ro(r,3)+"Z":s?"T"+ro(i,2)+":"+ro(n,2)+":"+ro(s,2)+"Z":n||i?"T"+ro(i,2)+":"+ro(n,2)+"Z":"")}function oo(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return io;if(h)return h=!1,eo;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Ja.DSV;const i=$a(co,e),{delimiter:n}=i;if(!tn(n))throw new TypeError("Invalid delimiter: must be a string!");return oo(n).parse(t)},po=function(t){return(arguments.length>2?arguments[2]:void 0).type=Ja.DSV,lo(t)},go=function(t){return(arguments.length>2?arguments[2]:void 0).type=Ja.DSV,ho(t)};function fo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return mo(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return mo(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return _o(t);default:throw new Error("unknown GeoJSON type")}}function mo(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=yo(t.properties),e.geometry=_o(t.geometry),e}function yo(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=yo(n):e[i]=n})),e):e}function _o(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return _o(t)})),e):(e.coordinates=vo(t.coordinates),e)}function vo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return vo(t)}))}function bo(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function xo(t){for(var e,i,n=bo(t),s=0,r=1;r0}function So(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=fo(t));var r=[];switch(t.type){case"GeometryCollection":return wo(t,(function(t){ko(t,n)})),t;case"FeatureCollection":return So(t,(function(t){So(ko(t,n),(function(t){r.push(t)}))})),Ua(r)}return ko(t,n)}function ko(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return wo(t,(function(t){ko(t,e)})),t;case"LineString":return Mo(bo(t),e),t;case"Polygon":return Co(bo(t),e),t;case"MultiLineString":return bo(t).forEach((function(t){Mo(t,e)})),t;case"MultiPolygon":return bo(t).forEach((function(t){Co(t,e)})),t;case"Point":case"MultiPoint":return t}}function Mo(t,e){xo(t)===e&&t.reverse()}function Co(t,e){xo(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=To(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Bo=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Ja.GEO;const i=$a(Ro,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Po(t))})):e.push(Po(t))})),e})(t);let o=t.features;return a&&(o=Ao(t,{reverse:!qi(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Eo.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Eo.bounds(t);t.bbox=e}})),t.features=o,t},Io={},Do=(t,e,i)=>{i.type=Ja.GEO;const n=$a(Ro,Io,e),{object:s}=n;if(!tn(s))throw new TypeError("Invalid object: must be a string!");const r=Ci(t,t.objects[s]);return Bo(r,n,i)},Lo=(t,e,i)=>{const n=!Yi(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!en(t))throw new TypeError("Invalid data: must be DataView array!");return en(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Oo=0;function Fo(){return Oo>1e8&&(Oo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+Oo++}class zo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new Ui,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Fo("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){this.transformMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const Ho="_data-view-diff-rank";class jo{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new Ui,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Fo("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",to),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=yn(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=yn(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[Ho]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[Ho]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[Ho][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear};utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear};parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1};parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1};parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1};parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1};parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1};parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1};parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1};parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Vo(t,e){const i=new Set(Cn(t)),n=new Set(Cn(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Wo}=$s,Uo=(t,e)=>($i(Yo.warnHandler)&&Yo.warnHandler.call(null,t,e),e?Cr.getInstance().warn(`[VChart warn]: ${t}`,e):Cr.getInstance().warn(`[VChart warn]: ${t}`)),Go=(t,e,i)=>{const n=new Error(t);return Cr.getInstance().error(`[VChart error]: ${n}`,e)},Yo={silent:!1,warnHandler:!1,errorHandler:!1},$o="undefined"!=typeof window&&void 0!==window.document,Xo=$o&&globalThis.document;function Ko(t){return("desktop-browser"===t||"mobile-browser"===t)&&$o}function qo(t){return"miniApp"===t||"mobile-browser"===t}function Zo(t){return t.includes("miniApp")||"lynx"===t}let Jo=0;function Qo(){return Jo>=9999999&&(Jo=0),Jo++}function tl(t){return!Xi(t)&&(!!rn(t)||+t==+t)}function el(t){return!(!t||0===t.length)&&(!Xi(t[0])&&!Xi(t[0].dataId)&&en(t[0].fields))}const il=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const nl=t=>e=>pn(e,t);function sl(t,e,i){const n=[e].concat([].slice.call(i));console[t].apply(console,n)}var rl;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rl||(rl={}));class al{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rl.None,e=arguments.length>1?arguments[1]:void 0;this._level=t,this._method=e}canLogInfo(){return this._level>=rl.Info}canLogDebug(){return this._level>=rl.Debug}canLogError(){return this._level>=rl.Error}canLogWarn(){return this._level>=rl.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=rl.Error&&sl(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rl.Warn&&sl(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rl.Info&&sl(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rl.Debug&&sl(this._method||"log","DEBUG",e),this}}let ol=null;const ll=(t,e)=>(ol&&rn(t)?ol.level(t):ol||(ol=new al(t,e)),ol),hl=t=>{ll().error(t)},cl=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if($i(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||hl("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&hl("Access path missing closing bracket: "+t),a&&hl("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return il((i&&i.get||nl)(n),[s],e||s)},dl=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(en(t)){const n=t.map((t=>cl(t,e,i)));return t=>n.map((e=>e(t)))}return cl(t,e,i)};dl("id");const ul=il((function(t){return t}),[],"identity"),pl=il((function(){return 0}),[],"zero");il((function(){return 1}),[],"one"),il((function(){return!0}),[],"true"),il((function(){return!1}),[],"false"),il((function(){return{}}),[],"emptyObject");const gl=(t,e)=>{if((te||Xi(e))&&!Xi(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},fl=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>gl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=Cn(e)||[],s=[],r=[],a={},o=i.comparator||fl;return Cn(t).forEach(((t,e)=>{if(Xi(t))return;s.push("desc"===n[e]?-1:1);const o=$i(t)?t:dl(t,null,i);var l;r.push(o),(l=o,(Xi(l)?null:l.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:il(o(r,s),Object.keys(a))},yl=(t,e)=>{const i=$i(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(Xi(e)||Xi(i))return Xi(e)&&Xi(i);if(!Zi(e)&&!Zi(i))return e===i;const s=en(e)?e:e[t],r=en(i)?i:i[t];return s===r||!1!==n&&(en(r)?!(!en(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!qi(r)&&!(!qi(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>_l(t,r,s)))))},vl=(t,e)=>Xi(t)?e:Math.min(tn(t)?e*parseFloat(t)/100:t,e);function bl(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!Xi(s)&&(s=+s)>=s&&!Xi(r)&&(r=+r)>=r&&n(s,r,++a)}))}function xl(t,e,i,n,s){let r=0,a=0;return bl(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function Sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;bl(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:xl(t,e,i,s,h)}}const wl=Un;function Al(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const kl=t=>an(t)?Es(t):null,Ml=t=>an(t)?Rs(t):null;function Cl(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Tl(t,e,i,n){const s=Cl({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function El(t){return 3===t||4===t}function Rl(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}function Pl(t,e){const i=e?+t[0][e]:+t[0];if(!an(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return an(n)&&n{const n=e?+i[e]:+i;return an(n)&&n>t&&(t=n),t}),i)}function Il(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;an(s)&&(i+=s,n++)}));return i/n}function Dl(t,e){const i=Il(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Ll(t){let e="center",i="middle";return e=(t=Al(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}}function Ol(t,e){const i=Fl(t),n=Fl(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function Fl(t,e={x:0,y:0}){return ks.distancePP(t,e)}function zl(t,e,i){let n=!1;if(e&&$i(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function Hl(t){return function(e){let i;return i=en(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var jl;function Nl(t){switch(t){case jl.Linear:case jl.Log:case jl.Pow:case jl.Sqrt:case jl.Symlog:case jl.Time:return!0;default:return!1}}function Vl(t){switch(t){case jl.Linear:case jl.Log:case jl.Pow:case jl.Sqrt:case jl.Symlog:case jl.Time:case jl.Ordinal:case jl.Point:case jl.Band:return!0;default:return!1}}function Wl(t){switch(t){case jl.Ordinal:case jl.Point:case jl.Band:return!0;default:return!1}}!function(t){t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(jl||(jl={}));class Ul{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Gl=Symbol("implicit");class Yl extends Ul{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=jl.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Gl}clone(){return(new Yl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!Xi(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==Gl)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Kl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),ql=t=>t<0?-t*t:t*t,Zl=t=>-Math.log(-t),Jl=t=>-Math.exp(-t),Ql=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,th=t=>10===t?Ql:t===Math.E?Math.exp:e=>Math.pow(t,e),eh=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),ih=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),nh=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function sh(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function rh(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function ah(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class hh extends Yl{constructor(t){super(),this.type=jl.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Bn(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[Dn(t[0]),Dn(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[Dn(t[0]),Dn(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:lh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return lh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=Zn(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}clone(){return new hh(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:ch}=$s;function dh(t,e){const i=typeof e;let n;if(Xi(e)||"boolean"===i)return()=>e;if("number"===i)return es(t,e);if("string"===i){if(n=Ws.parseColorString(e)){const e=ch(Ws.parseColorString(t),n);return t=>e(t).formatRgb()}return es(Number(t),Number(e))}return e instanceof Us?ch(t,e):e instanceof Ws?ch(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):es(Number(t),Number(e))}class uh extends Ul{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$l,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$l;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=$l,this._piecewise=rh,this._interpolate=dh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),es)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,Dn);return this._domain=i,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=is,this.rescale(e)}rescale(t){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=Zn(this._domain[0],this._domain[n-1])),this._piecewise=n>2?ah:rh,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:$l),this.rescale(i)):this._clamp!==$l}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ph=Math.sqrt(50),gh=Math.sqrt(10),fh=Math.sqrt(2);function mh(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=ph?a=10:r>=gh?a=5:r>=fh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function _h(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=yh(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class xh extends uh{constructor(){super(...arguments),this.type=jl.Linear}clone(){return(new xh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return _h(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return vh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=bh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=bh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=bh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function Sh(t){return e=>-t(-e)}class wh extends uh{constructor(){super(eh(10),th(10)),this.type=jl.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new wh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){if(t)return this;super.rescale();const e=eh(this._base),i=th(this._base);return this._domain[0]<0?(this._logs=Sh(e),this._pows=Sh(i),this.transformer=Zl,this.untransformer=Jl):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return $l}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.lengththis._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}}class Ah extends hh{constructor(t){super(!1),this.type=jl.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class kh extends xh{constructor(){super(),this.type=jl.Pow,this._exponent=1}clone(){return(new kh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=$l,this.untransformer=$l):.5===this._exponent?(this.transformer=Kl,this.untransformer=ql):(this.transformer=Xl(this._exponent),this.untransformer=Xl(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function Mh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class Ch{constructor(){this.type=jl.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return Mh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new Th).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return mh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return _h(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return vh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=bh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=bh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=bh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class Eh extends xh{constructor(){super(Kl,ql),this.type=jl.Sqrt}clone(){return(new Eh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Rh extends xh{constructor(){super(ih(1),nh(1)),this.type=jl.Symlog,this._const=1}clone(){return(new Rh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=ih(t),this.untransformer=nh(t),this.rescale(e)):this._const}}class Ph{constructor(){this.type=jl.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!Xi(t)&&an(+t)?this._range[On(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new Ph).domain(this._domain).range(this._range).unknown(this._unknown)}}const Bh=[["second",1,Fr],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,zr],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,Hr],["hour",3,3*Hr],["hour",6,6*Hr],["hour",12,12*Hr],["day",1,jr],["day",2,2*jr],["day",7,7*jr],["month",1,Nr],["month",3,3*Nr],["month",6,6*Nr],["year",1,365*jr]];function Ih(t){return+as(t)}function Dh(t,e,i,n){const s=(+e-+t)/i,r=On(Bh.map((t=>t[2])),s);if(r===Bh.length){const s=Math.max(Nn(+t/Vr,+e/Vr,i),1),r=t=>(t[Or(n)](Math.floor(t[Er(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Or(n)](t[Er(n)]()+e*s),t);return{floor:r,offset:a,ceil:Fa(r,a)}}if(0===r){const n=Math.max(Nn(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Fa(s,r)}}const[a,o]=Bh[s/Bh[r-1][2]"year"===t&&e?{floor:$r,offset:Xr,count:Kr,field:qr}:"month"===t&&e?{floor:ea,offset:ia,count:na,field:sa}:"day"===t&&e?{floor:ha,offset:ca,count:da,field:ua}:"hour"===t&&e?{floor:ya,offset:_a,count:fa,field:va}:"minute"===t&&e?{floor:Aa,offset:ka,count:Sa,field:Ma}:"second"===t&&e?{floor:Pa,offset:Ba,count:Ea,field:Ia}:"year"===t?{floor:Wr,offset:Ur,count:Gr,field:Yr}:"month"===t?{floor:Zr,offset:Jr,count:Qr,field:ta}:"day"===t?{floor:ra,offset:aa,count:oa,field:la}:"hour"===t?{floor:pa,offset:ga,count:fa,field:ma}:"minute"===t?{floor:ba,offset:xa,count:Sa,field:wa}:"second"===t?{floor:Ca,offset:Ta,count:Ea,field:Ra}:{floor:Da,offset:La,count:Oa})(a,n);return za(o,l)}class Lh extends uh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=jl.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(as);const i=Array.from(t,Ih);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=as(t),s=e[Er(n)](),r=e[Rr(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Pr(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[Br(n)](),c=(h-1)%12+1,d=e[Ir(n)](),u=e[Dr(n)](),p=e[Lr(n)]();return(i||"").replace(/YYYY/g,Xn(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,Xn(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,Xn(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,Xn(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,Xn(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,Xn(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,Xn(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,Xn(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Lh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(rn(t)||Xi(t))&&(i=Dh(e[0],e[e.length-1],Xi(t)?10:t,this._isUtc)),i&&this.domain(oh(e,i)),this}utc(){return this._isUtc}}function Oh(t,e){const i=Ki(e)?t?.[e]??t?.default:t?.default;if(!i||en(i))return i;if(qi(i)){const{dataScheme:n}=i;return n?Nh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>jh(i)?zh(t,i,e):i)).filter(Ki)}))):n.map((i=>jh(i)?zh(t,i,e):i)).filter(Ki):[]}return[]}function Fh(t,e){return Nh(t)?t.find((t=>Ki(t.isAvailable)?$i(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!Ki(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function zh(t,e,i){const n=Ki(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!Ki(e.a)&&!Ki(e.l)||!tn(s))return s;let r=new Wo(s);if(Ki(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Fs(t,i,n),o=Os(s,a,e.l),l=new Wo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return Ki(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Hh=(t,e,i)=>{if(jh(t)&&e){const n=zh(e,t,i);if(n)return n}return t};function jh(t){return qi(t)&&"palette"===t.type&&!!t.key}function Nh(t){return!!en(t)&&t.every((t=>Ki(t.scheme)))}class Vh extends Yl{_range;range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Nh(this._range))return void super.range(this._range);const t=Fh(this._range,this._domain);super.range(t)}}const Wh={linear:xh,band:hh,point:Ah,ordinal:Yl,threshold:Ph,colorOrdinal:Vh};function Uh(t){const e=Wh[t];return e?new e:null}function Gh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Yh(t){return Ki(t?.field)&&Ki(t?.scale)}var $h;function Xh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Kh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function qh(t){return!!tn(t)&&(!!t.endsWith("%")&&tl(t.substring(0,t.length-1)))}function Zh(t,e,i){return rn(t)?t:qh(t)?Number(t.substring(0,t.length-1))*e/100:$i(t)?t(i):0}function Jh(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>rn(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=Zh(t[s],e.size,i)}))})),n}function Qh(t){let e={};return en(t)?(Xi(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),Xi(t[1])||(e.left=e.right=t[1]),Xi(t[2])||(e.bottom=t[2]),Xi(t[3])||(e.left=t[3]),e):rn(t)||qh(t)||$i(t)?(e.top=e.left=e.bottom=e.right=t,e):(qi(t)&&(e={...t}),e)}function tc(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function ec(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=ec(t[n],e)}return i}return en(t)?t.map((t=>ec(t,e))):t}function ic(t){const e=t;let i;if(!Ki(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof jo||e.every((t=>i.includes(t)))}(e))return e;const n=en(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:Yi(e)||rn(e)||tn(e)?e:sn(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=ic(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}($h||($h={}));var nc=function(t){return t&&t.Math==Math&&t},sc=nc("object"==typeof globalThis&&globalThis)||nc("object"==typeof window&&window)||nc("object"==typeof self&&self)||nc("object"==typeof ni&&ni)||function(){return this}()||ni||Function("return this")(),rc={},ac=function(t){try{return!!t()}catch(t){return!0}},oc=!ac((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),lc=!ac((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),hc=lc,cc=Function.prototype.call,dc=hc?cc.bind(cc):function(){return cc.apply(cc,arguments)},uc={},pc={}.propertyIsEnumerable,gc=Object.getOwnPropertyDescriptor,fc=gc&&!pc.call({1:2},1);uc.f=fc?function(t){var e=gc(this,t);return!!e&&e.enumerable}:pc;var mc,yc,_c=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},vc=lc,bc=Function.prototype,xc=bc.call,Sc=vc&&bc.bind.bind(xc,xc),wc=vc?Sc:function(t){return function(){return xc.apply(t,arguments)}},Ac=wc,kc=Ac({}.toString),Mc=Ac("".slice),Cc=function(t){return Mc(kc(t),8,-1)},Tc=ac,Ec=Cc,Rc=Object,Pc=wc("".split),Bc=Tc((function(){return!Rc("z").propertyIsEnumerable(0)}))?function(t){return"String"==Ec(t)?Pc(t,""):Rc(t)}:Rc,Ic=function(t){return null==t},Dc=Ic,Lc=TypeError,Oc=function(t){if(Dc(t))throw Lc("Can't call method on "+t);return t},Fc=Bc,zc=Oc,Hc=function(t){return Fc(zc(t))},jc="object"==typeof document&&document.all,Nc={all:jc,IS_HTMLDDA:void 0===jc&&void 0!==jc},Vc=Nc.all,Wc=Nc.IS_HTMLDDA?function(t){return"function"==typeof t||t===Vc}:function(t){return"function"==typeof t},Uc=Wc,Gc=Nc.all,Yc=Nc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Uc(t)||t===Gc}:function(t){return"object"==typeof t?null!==t:Uc(t)},$c=sc,Xc=Wc,Kc=function(t,e){return arguments.length<2?(i=$c[t],Xc(i)?i:void 0):$c[t]&&$c[t][e];var i},qc=wc({}.isPrototypeOf),Zc=sc,Jc="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Qc=Zc.process,td=Zc.Deno,ed=Qc&&Qc.versions||td&&td.version,id=ed&&ed.v8;id&&(yc=(mc=id.split("."))[0]>0&&mc[0]<4?1:+(mc[0]+mc[1])),!yc&&Jc&&(!(mc=Jc.match(/Edge\/(\d+)/))||mc[1]>=74)&&(mc=Jc.match(/Chrome\/(\d+)/))&&(yc=+mc[1]);var nd=yc,sd=ac,rd=sc.String,ad=!!Object.getOwnPropertySymbols&&!sd((function(){var t=Symbol();return!rd(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&nd&&nd<41})),od=ad&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ld=Kc,hd=Wc,cd=qc,dd=Object,ud=od?function(t){return"symbol"==typeof t}:function(t){var e=ld("Symbol");return hd(e)&&cd(e.prototype,dd(t))},pd=String,gd=function(t){try{return pd(t)}catch(t){return"Object"}},fd=Wc,md=gd,yd=TypeError,_d=function(t){if(fd(t))return t;throw yd(md(t)+" is not a function")},vd=_d,bd=Ic,xd=function(t,e){var i=t[e];return bd(i)?void 0:vd(i)},Sd=dc,wd=Wc,Ad=Yc,kd=TypeError,Md={exports:{}},Cd=sc,Td=Object.defineProperty,Ed=function(t,e){try{Td(Cd,t,{value:e,configurable:!0,writable:!0})}catch(i){Cd[t]=e}return e},Rd=Ed,Pd="__core-js_shared__",Bd=sc[Pd]||Rd(Pd,{}),Id=Bd;(Md.exports=function(t,e){return Id[t]||(Id[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Dd=Md.exports,Ld=Oc,Od=Object,Fd=function(t){return Od(Ld(t))},zd=Fd,Hd=wc({}.hasOwnProperty),jd=Object.hasOwn||function(t,e){return Hd(zd(t),e)},Nd=wc,Vd=0,Wd=Math.random(),Ud=Nd(1..toString),Gd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Ud(++Vd+Wd,36)},Yd=Dd,$d=jd,Xd=Gd,Kd=ad,qd=od,Zd=sc.Symbol,Jd=Yd("wks"),Qd=qd?Zd.for||Zd:Zd&&Zd.withoutSetter||Xd,tu=function(t){return $d(Jd,t)||(Jd[t]=Kd&&$d(Zd,t)?Zd[t]:Qd("Symbol."+t)),Jd[t]},eu=dc,iu=Yc,nu=ud,su=xd,ru=function(t,e){var i,n;if("string"===e&&wd(i=t.toString)&&!Ad(n=Sd(i,t)))return n;if(wd(i=t.valueOf)&&!Ad(n=Sd(i,t)))return n;if("string"!==e&&wd(i=t.toString)&&!Ad(n=Sd(i,t)))return n;throw kd("Can't convert object to primitive value")},au=TypeError,ou=tu("toPrimitive"),lu=function(t,e){if(!iu(t)||nu(t))return t;var i,n=su(t,ou);if(n){if(void 0===e&&(e="default"),i=eu(n,t,e),!iu(i)||nu(i))return i;throw au("Can't convert object to primitive value")}return void 0===e&&(e="number"),ru(t,e)},hu=ud,cu=function(t){var e=lu(t,"string");return hu(e)?e:e+""},du=Yc,uu=sc.document,pu=du(uu)&&du(uu.createElement),gu=function(t){return pu?uu.createElement(t):{}},fu=gu,mu=!oc&&!ac((function(){return 7!=Object.defineProperty(fu("div"),"a",{get:function(){return 7}}).a})),yu=oc,_u=dc,vu=uc,bu=_c,xu=Hc,Su=cu,wu=jd,Au=mu,ku=Object.getOwnPropertyDescriptor;rc.f=yu?ku:function(t,e){if(t=xu(t),e=Su(e),Au)try{return ku(t,e)}catch(t){}if(wu(t,e))return bu(!_u(vu.f,t,e),t[e])};var Mu={},Cu=oc&&ac((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Tu=Yc,Eu=String,Ru=TypeError,Pu=function(t){if(Tu(t))return t;throw Ru(Eu(t)+" is not an object")},Bu=oc,Iu=mu,Du=Cu,Lu=Pu,Ou=cu,Fu=TypeError,zu=Object.defineProperty,Hu=Object.getOwnPropertyDescriptor,ju="enumerable",Nu="configurable",Vu="writable";Mu.f=Bu?Du?function(t,e,i){if(Lu(t),e=Ou(e),Lu(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Vu in i&&!i[Vu]){var n=Hu(t,e);n&&n[Vu]&&(t[e]=i.value,i={configurable:Nu in i?i[Nu]:n[Nu],enumerable:ju in i?i[ju]:n[ju],writable:!1})}return zu(t,e,i)}:zu:function(t,e,i){if(Lu(t),e=Ou(e),Lu(i),Iu)try{return zu(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Fu("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var Wu=Mu,Uu=_c,Gu=oc?function(t,e,i){return Wu.f(t,e,Uu(1,i))}:function(t,e,i){return t[e]=i,t},Yu={exports:{}},$u=oc,Xu=jd,Ku=Function.prototype,qu=$u&&Object.getOwnPropertyDescriptor,Zu=Xu(Ku,"name"),Ju={EXISTS:Zu,PROPER:Zu&&"something"===function(){}.name,CONFIGURABLE:Zu&&(!$u||$u&&qu(Ku,"name").configurable)},Qu=Wc,tp=Bd,ep=wc(Function.toString);Qu(tp.inspectSource)||(tp.inspectSource=function(t){return ep(t)});var ip,np,sp,rp=tp.inspectSource,ap=Wc,op=sc.WeakMap,lp=ap(op)&&/native code/.test(String(op)),hp=Gd,cp=Dd("keys"),dp=function(t){return cp[t]||(cp[t]=hp(t))},up={},pp=lp,gp=sc,fp=Yc,mp=Gu,yp=jd,_p=Bd,vp=dp,bp=up,xp="Object already initialized",Sp=gp.TypeError,wp=gp.WeakMap;if(pp||_p.state){var Ap=_p.state||(_p.state=new wp);Ap.get=Ap.get,Ap.has=Ap.has,Ap.set=Ap.set,ip=function(t,e){if(Ap.has(t))throw Sp(xp);return e.facade=t,Ap.set(t,e),e},np=function(t){return Ap.get(t)||{}},sp=function(t){return Ap.has(t)}}else{var kp=vp("state");bp[kp]=!0,ip=function(t,e){if(yp(t,kp))throw Sp(xp);return e.facade=t,mp(t,kp,e),e},np=function(t){return yp(t,kp)?t[kp]:{}},sp=function(t){return yp(t,kp)}}var Mp={set:ip,get:np,has:sp,enforce:function(t){return sp(t)?np(t):ip(t,{})},getterFor:function(t){return function(e){var i;if(!fp(e)||(i=np(e)).type!==t)throw Sp("Incompatible receiver, "+t+" required");return i}}},Cp=wc,Tp=ac,Ep=Wc,Rp=jd,Pp=oc,Bp=Ju.CONFIGURABLE,Ip=rp,Dp=Mp.enforce,Lp=Mp.get,Op=String,Fp=Object.defineProperty,zp=Cp("".slice),Hp=Cp("".replace),jp=Cp([].join),Np=Pp&&!Tp((function(){return 8!==Fp((function(){}),"length",{value:8}).length})),Vp=String(String).split("String"),Wp=Yu.exports=function(t,e,i){"Symbol("===zp(Op(e),0,7)&&(e="["+Hp(Op(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Rp(t,"name")||Bp&&t.name!==e)&&(Pp?Fp(t,"name",{value:e,configurable:!0}):t.name=e),Np&&i&&Rp(i,"arity")&&t.length!==i.arity&&Fp(t,"length",{value:i.arity});try{i&&Rp(i,"constructor")&&i.constructor?Pp&&Fp(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Dp(t);return Rp(n,"source")||(n.source=jp(Vp,"string"==typeof e?e:"")),t};Function.prototype.toString=Wp((function(){return Ep(this)&&Lp(this).source||Ip(this)}),"toString");var Up=Yu.exports,Gp=Wc,Yp=Mu,$p=Up,Xp=Ed,Kp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Gp(i)&&$p(i,r,n),n.global)s?t[e]=i:Xp(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Yp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},qp={},Zp=Math.ceil,Jp=Math.floor,Qp=Math.trunc||function(t){var e=+t;return(e>0?Jp:Zp)(e)},tg=function(t){var e=+t;return e!=e||0===e?0:Qp(e)},eg=tg,ig=Math.max,ng=Math.min,sg=function(t,e){var i=eg(t);return i<0?ig(i+e,0):ng(i,e)},rg=tg,ag=Math.min,og=function(t){return t>0?ag(rg(t),9007199254740991):0},lg=function(t){return og(t.length)},hg=Hc,cg=sg,dg=lg,ug=function(t){return function(e,i,n){var s,r=hg(e),a=dg(r),o=cg(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},pg={includes:ug(!0),indexOf:ug(!1)},gg=jd,fg=Hc,mg=pg.indexOf,yg=up,_g=wc([].push),vg=function(t,e){var i,n=fg(t),s=0,r=[];for(i in n)!gg(yg,i)&&gg(n,i)&&_g(r,i);for(;e.length>s;)gg(n,i=e[s++])&&(~mg(r,i)||_g(r,i));return r},bg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],xg=vg,Sg=bg.concat("length","prototype");qp.f=Object.getOwnPropertyNames||function(t){return xg(t,Sg)};var wg={};wg.f=Object.getOwnPropertySymbols;var Ag=Kc,kg=qp,Mg=wg,Cg=Pu,Tg=wc([].concat),Eg=Ag("Reflect","ownKeys")||function(t){var e=kg.f(Cg(t)),i=Mg.f;return i?Tg(e,i(t)):e},Rg=jd,Pg=Eg,Bg=rc,Ig=Mu,Dg=ac,Lg=Wc,Og=/#|\.prototype\./,Fg=function(t,e){var i=Hg[zg(t)];return i==Ng||i!=jg&&(Lg(e)?Dg(e):!!e)},zg=Fg.normalize=function(t){return String(t).replace(Og,".").toLowerCase()},Hg=Fg.data={},jg=Fg.NATIVE="N",Ng=Fg.POLYFILL="P",Vg=Fg,Wg=sc,Ug=rc.f,Gg=Gu,Yg=Kp,$g=Ed,Xg=function(t,e,i){for(var n=Pg(e),s=Ig.f,r=Bg.f,a=0;ar;r++)if((o=y(t[r]))&&wm(Em,o))return o;return new Tm(!1)}n=Am(t,s)}for(l=u?t.next:n.next;!(h=_m(l,n)).done;){try{o=y(h.value)}catch(t){Mm(n,"throw",t)}if("object"==typeof o&&o&&wm(Em,o))return o}return new Tm(!1)},Pm=qc,Bm=TypeError,Im=function(t,e){if(Pm(e,t))return t;throw Bm("Incorrect invocation")},Dm=tu("iterator"),Lm=!1;try{var Om=0,Fm={next:function(){return{done:!!Om++}},return:function(){Lm=!0}};Fm[Dm]=function(){return this},Array.from(Fm,(function(){throw 2}))}catch(hl){}var zm=Mu.f,Hm=jd,jm=tu("toStringTag"),Nm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Hm(t,jm)&&zm(t,jm,{configurable:!0,value:e})},Vm=wc,Wm=_d,Um=Wc,Gm=String,Ym=TypeError,$m=function(t,e,i){try{return Vm(Wm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Xm=Pu,Km=function(t){if("object"==typeof t||Um(t))return t;throw Ym("Can't set "+Gm(t)+" as a prototype")},qm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=$m(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Xm(i),Km(n),e?t(i,n):i.__proto__=n,i}}():void 0),Zm=Wc,Jm=Yc,Qm=qm,ty=qg,ey=sc,iy=wc,ny=Vg,sy=Kp,ry=Of,ay=Rm,oy=Im,ly=Wc,hy=Ic,cy=Yc,dy=ac,uy=function(t,e){if(!e&&!Lm)return!1;var i=!1;try{var n={};n[Dm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},py=Nm,gy=function(t,e,i){var n,s;return Qm&&Zm(n=e.constructor)&&n!==i&&Jm(s=n.prototype)&&s!==i.prototype&&Qm(t,s),t},fy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=ey[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=iy(o[t]);sy(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!cy(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!cy(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!cy(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ny(t,!ly(a)||!(s||o.forEach&&!dy((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),ry.enable();else if(ny(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=dy((function(){d.has(1)})),g=uy((function(t){new a(t)})),f=!s&&dy((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){oy(t,o);var i=gy(new a,t,l);return hy(e)||ay(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,ty({global:!0,constructor:!0,forced:l!=a},h),py(l,t),s||i.setStrong(l,t,n),l},my={},yy=vg,_y=bg,vy=Object.keys||function(t){return yy(t,_y)},by=oc,xy=Cu,Sy=Mu,wy=Pu,Ay=Hc,ky=vy;my.f=by&&!xy?Object.defineProperties:function(t,e){wy(t);for(var i,n=Ay(e),s=ky(e),r=s.length,a=0;r>a;)Sy.f(t,i=s[a++],n[i]);return t};var My,Cy=Kc("document","documentElement"),Ty=Pu,Ey=my,Ry=bg,Py=up,By=Cy,Iy=gu,Dy="prototype",Ly="script",Oy=dp("IE_PROTO"),Fy=function(){},zy=function(t){return"<"+Ly+">"+t+""},Hy=function(t){t.write(zy("")),t.close();var e=t.parentWindow.Object;return t=null,e},jy=function(){try{My=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;jy="undefined"!=typeof document?document.domain&&My?Hy(My):(e=Iy("iframe"),i="java"+Ly+":",e.style.display="none",By.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(zy("document.F=Object")),t.close(),t.F):Hy(My);for(var n=Ry.length;n--;)delete jy[Dy][Ry[n]];return jy()};Py[Oy]=!0;var Ny,Vy,Wy,Uy=Object.create||function(t,e){var i;return null!==t?(Fy[Dy]=Ty(t),i=new Fy,Fy[Dy]=null,i[Oy]=t):i=jy(),void 0===e?i:Ey.f(i,e)},Gy=Up,Yy=Mu,$y=function(t,e,i){return i.get&&Gy(i.get,e,{getter:!0}),i.set&&Gy(i.set,e,{setter:!0}),Yy.f(t,e,i)},Xy=Kp,Ky=function(t,e,i){for(var n in e)Xy(t,n,e[n],i);return t},qy=!ac((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Zy=jd,Jy=Wc,Qy=Fd,t_=qy,e_=dp("IE_PROTO"),i_=Object,n_=i_.prototype,s_=t_?i_.getPrototypeOf:function(t){var e=Qy(t);if(Zy(e,e_))return e[e_];var i=e.constructor;return Jy(i)&&e instanceof i?i.prototype:e instanceof i_?n_:null},r_=ac,a_=Wc,o_=Yc,l_=s_,h_=Kp,c_=tu("iterator"),d_=!1;[].keys&&("next"in(Wy=[].keys())?(Vy=l_(l_(Wy)))!==Object.prototype&&(Ny=Vy):d_=!0);var u_=!o_(Ny)||r_((function(){var t={};return Ny[c_].call(t)!==t}));u_&&(Ny={}),a_(Ny[c_])||h_(Ny,c_,(function(){return this}));var p_={IteratorPrototype:Ny,BUGGY_SAFARI_ITERATORS:d_},g_=p_.IteratorPrototype,f_=Uy,m_=_c,y_=Nm,__=Uf,v_=function(){return this},b_=qg,x_=dc,S_=Wc,w_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=f_(g_,{next:m_(+!n,i)}),y_(t,s,!1),__[s]=v_,t},A_=s_,k_=qm,M_=Nm,C_=Gu,T_=Kp,E_=Uf,R_=Ju.PROPER,P_=Ju.CONFIGURABLE,B_=p_.IteratorPrototype,I_=p_.BUGGY_SAFARI_ITERATORS,D_=tu("iterator"),L_="keys",O_="values",F_="entries",z_=function(){return this},H_=Kc,j_=$y,N_=oc,V_=tu("species"),W_=Uy,U_=$y,G_=Ky,Y_=Wf,$_=Im,X_=Ic,K_=Rm,q_=function(t,e,i,n,s,r,a){w_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!I_&&t in p)return p[t];switch(t){case L_:case O_:case F_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[D_]||p["@@iterator"]||s&&p[s],f=!I_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=A_(m.call(new t)))!==Object.prototype&&o.next&&(A_(o)!==B_&&(k_?k_(o,B_):S_(o[D_])||T_(o,D_,z_)),M_(o,d,!0)),R_&&s==O_&&g&&g.name!==O_&&(P_?C_(p,"name",O_):(u=!0,f=function(){return x_(g,this)})),s)if(l={values:c(O_),keys:r?f:c(L_),entries:c(F_)},a)for(h in l)(I_||u||!(h in p))&&T_(p,h,l[h]);else b_({target:e,proto:!0,forced:I_||u},l);return p[D_]!==f&&T_(p,D_,f,{name:s}),E_[e]=f,l},Z_=function(t,e){return{value:t,done:e}},J_=function(t){var e=H_(t);N_&&e&&!e[V_]&&j_(e,V_,{configurable:!0,get:function(){return this}})},Q_=oc,tv=Of.fastKey,ev=Mp.set,iv=Mp.getterFor,nv={getConstructor:function(t,e,i,n){var s=t((function(t,s){$_(t,r),ev(t,{type:e,index:W_(null),first:void 0,last:void 0,size:0}),Q_||(t.size=0),X_(s)||K_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=iv(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=tv(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),Q_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=tv(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return G_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,Q_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),Q_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=Y_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),G_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),Q_&&U_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=iv(e),r=iv(n);q_(t,e,(function(t,e){ev(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?Z_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,Z_(void 0,!0))}),i?"entries":"values",!i,!0),J_(e)}};fy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),nv);var sv=Cc,rv=Array.isArray||function(t){return"Array"==sv(t)},av=wc,ov=ac,lv=Wc,hv=em,cv=rp,dv=function(){},uv=[],pv=Kc("Reflect","construct"),gv=/^\s*(?:class|function)\b/,fv=av(gv.exec),mv=!gv.exec(dv),yv=function(t){if(!lv(t))return!1;try{return pv(dv,uv,t),!0}catch(t){return!1}},_v=function(t){if(!lv(t))return!1;switch(hv(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return mv||!!fv(gv,cv(t))}catch(t){return!0}};_v.sham=!0;var vv=!pv||ov((function(){var t;return yv(yv.call)||!yv(Object)||!yv((function(){t=!0}))||t}))?_v:yv,bv=rv,xv=vv,Sv=Yc,wv=tu("species"),Av=Array,kv=function(t){var e;return bv(t)&&(e=t.constructor,(xv(e)&&(e===Av||bv(e.prototype))||Sv(e)&&null===(e=e[wv]))&&(e=void 0)),void 0===e?Av:e},Mv=Wf,Cv=Bc,Tv=Fd,Ev=lg,Rv=function(t,e){return new(kv(t))(0===e?0:e)},Pv=wc([].push),Bv=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=Tv(l),f=Cv(g),m=Mv(h,c),y=Ev(f),_=0,v=d||Rv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Pv(b,u)}else switch(t){case 4:return!1;case 7:Pv(b,u)}return r?-1:n||s?s:b}},Iv={forEach:Bv(0),map:Bv(1),filter:Bv(2),some:Bv(3),every:Bv(4),find:Bv(5),findIndex:Bv(6),filterReject:Bv(7)},Dv=wc,Lv=Ky,Ov=Of.getWeakData,Fv=Im,zv=Pu,Hv=Ic,jv=Yc,Nv=Rm,Vv=jd,Wv=Mp.set,Uv=Mp.getterFor,Gv=Iv.find,Yv=Iv.findIndex,$v=Dv([].splice),Xv=0,Kv=function(t){return t.frozen||(t.frozen=new qv)},qv=function(){this.entries=[]},Zv=function(t,e){return Gv(t.entries,(function(t){return t[0]===e}))};qv.prototype={get:function(t){var e=Zv(this,t);if(e)return e[1]},has:function(t){return!!Zv(this,t)},set:function(t,e){var i=Zv(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Yv(this.entries,(function(e){return e[0]===t}));return~e&&$v(this.entries,e,1),!!~e}};var Jv,Qv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Fv(t,r),Wv(t,{type:e,id:Xv++,frozen:void 0}),Hv(s)||Nv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Uv(e),o=function(t,e,i){var n=a(t),s=Ov(zv(e),!0);return!0===s?Kv(n).set(e,i):s[n.id]=i,t};return Lv(r,{delete:function(t){var e=a(this);if(!jv(t))return!1;var i=Ov(t);return!0===i?Kv(e).delete(t):i&&Vv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!jv(t))return!1;var i=Ov(t);return!0===i?Kv(e).has(t):i&&Vv(i,e.id)}}),Lv(r,i?{get:function(t){var e=a(this);if(jv(t)){var i=Ov(t);return!0===i?Kv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},tb=bf,eb=sc,ib=wc,nb=Ky,sb=Of,rb=fy,ab=Qv,ob=Yc,lb=Mp.enforce,hb=ac,cb=lp,db=Object,ub=Array.isArray,pb=db.isExtensible,gb=db.isFrozen,fb=db.isSealed,mb=db.freeze,yb=db.seal,_b={},vb={},bb=!eb.ActiveXObject&&"ActiveXObject"in eb,xb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Sb=rb("WeakMap",xb,ab),wb=Sb.prototype,Ab=ib(wb.set);if(cb)if(bb){Jv=ab.getConstructor(xb,"WeakMap",!0),sb.enable();var kb=ib(wb.delete),Mb=ib(wb.has),Cb=ib(wb.get);nb(wb,{delete:function(t){if(ob(t)&&!pb(t)){var e=lb(this);return e.frozen||(e.frozen=new Jv),kb(this,t)||e.frozen.delete(t)}return kb(this,t)},has:function(t){if(ob(t)&&!pb(t)){var e=lb(this);return e.frozen||(e.frozen=new Jv),Mb(this,t)||e.frozen.has(t)}return Mb(this,t)},get:function(t){if(ob(t)&&!pb(t)){var e=lb(this);return e.frozen||(e.frozen=new Jv),Mb(this,t)?Cb(this,t):e.frozen.get(t)}return Cb(this,t)},set:function(t,e){if(ob(t)&&!pb(t)){var i=lb(this);i.frozen||(i.frozen=new Jv),Mb(this,t)?Ab(this,t,e):i.frozen.set(t,e)}else Ab(this,t,e);return this}})}else tb&&hb((function(){var t=mb([]);return Ab(new Sb,t,1),!gb(t)}))&&nb(wb,{set:function(t,e){var i;return ub(t)&&(gb(t)?i=_b:fb(t)&&(i=vb)),Ab(this,t,e),i==_b&&mb(t),i==vb&&yb(t),this}});var Tb=Kc,Eb=wc,Rb=Dd,Pb=Tb("Map"),Bb=Tb("WeakMap"),Ib=Eb([].push),Db=Rb("metadata"),Lb=Db.store||(Db.store=new Bb),Ob=function(t,e,i){var n=Lb.get(t);if(!n){if(!i)return;Lb.set(t,n=new Pb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Pb)}return s},Fb={store:Lb,getMap:Ob,has:function(t,e,i){var n=Ob(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Ob(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Ob(i,n,!0).set(t,e)},keys:function(t,e){var i=Ob(t,e,!1),n=[];return i&&i.forEach((function(t,e){Ib(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},zb=Pu,Hb=Fb.toKey,jb=Fb.set;qg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Hb(arguments[3]);jb(t,e,zb(i),n)}});var Nb=Pu,Vb=Fb.toKey,Wb=Fb.getMap,Ub=Fb.store;qg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Vb(arguments[2]),n=Wb(Nb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=Ub.get(e);return s.delete(i),!!s.size||Ub.delete(e)}});var Gb=Pu,Yb=s_,$b=Fb.has,Xb=Fb.get,Kb=Fb.toKey,qb=function(t,e,i){if($b(t,e,i))return Xb(t,e,i);var n=Yb(e);return null!==n?qb(t,n,i):void 0};qg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Kb(arguments[2]);return qb(t,Gb(e),i)}});var Zb=wc,Jb=Map.prototype,Qb={Map:Map,set:Zb(Jb.set),get:Zb(Jb.get),has:Zb(Jb.has),remove:Zb(Jb.delete),proto:Jb},tx=dc,ex=wc,ix=function(t,e,i){for(var n,s,r=i||t.next;!(n=tx(r,t)).done;)if(void 0!==(s=e(n.value)))return s},nx=Qb.Map,sx=Qb.proto,rx=ex(sx.forEach),ax=ex(sx.entries),ox=ax(new nx).next,lx=_d,hx=Ic,cx=lg,dx=Fd,ux=function(t,e,i){return i?ix(ax(t),(function(t){return e(t[1],t[0])}),ox):rx(t,e)},px=Qb.Map,gx=Qb.has,fx=Qb.set,mx=wc([].push),yx=qg,_x=wc,vx=Fb,bx=Pu,xx=s_,Sx=function(t){var e,i,n,s=dx(this),r=cx(s),a=[],o=new px,l=hx(t)?function(t){return t}:lx(t);for(e=0;e= than the number of constructor arguments of its base class."},bS=function(t,e){return"@postConstruct error in class "+t+": "+e},xS=function(t,e){return"@preDestroy error in class "+t+": "+e},SS=function(t,e){return"onDeactivation() error in class "+t+": "+e},wS="Maximum call stack size exceeded",AS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(tS,t),userGeneratedMetadata:Reflect.getMetadata(Jx,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(Qx,t)||[]},t}(),kS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function MS(t){return t instanceof RangeError||t.message===wS}function CS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function TS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=PS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function ES(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||ES(t.parentRequest,e))}function RS(t){t.childRequests.forEach((function(t){if(ES(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=CS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(yS+" "+e)}RS(t)}))}function PS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var BS=function(){function t(t){this.id=lS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),IS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Yx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),DS=function(t,e){this.parentContext=t,this.rootRequest=e},LS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),OS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),FS=function(){function t(t,e,i,n){this.id=lS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new OS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new IS(Yx,n):n instanceof IS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:WS(t,i)}return 0}function US(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[qx],multiInject:e[Zx],targetName:e[$x],unmanaged:e[Xx]}}var GS=function(){function t(t,e,i,n,s){this.id=lS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function YS(t){return t._bindingDictionary}function $S(t,e,i,n,s){var r=KS(i.container,s.serviceIdentifier),a=[];return r.length===kS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=KS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new GS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case kS.NoBindingsAvailable:if(i.isOptional())return e;var s=CS(t),r=gS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=TS(n,s,KS),new Error(r);case kS.OnlyOneBindingAvailable:return e;case kS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=CS(t),r=pS+" "+s;throw r+=TS(n,s,KS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function XS(t,e,i,n,s,r){var a,o;if(null===s){a=$S(t,e,n,null,r),o=new GS(i,n,null,a,r);var l=new DS(n,o);n.addPlan(l)}else a=$S(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===rS.Instance&&null!==e.implementationType){var s=function(t,e){return HS(t,PS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=WS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===aS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=JS(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=rw(rw({},s),{constr:t});n=s.isAsync?function(t){return aw(this,void 0,void 0,(function(){var e,i;return ow(this,(function(n){switch(n.label){case 0:return[4,dw(t.constructorInjections)];case 1:return e=n.sent(),[4,dw(t.propertyInjections)];case 2:return i=n.sent(),[2,cw(rw(rw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):cw(r)}else n=new t;return n}function cw(t){var e,i=new((e=t.constr).bind.apply(e,lw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function dw(t){return aw(this,void 0,void 0,(function(){var e,i,n,s;return ow(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Hw=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new zw,onDeactivations:new zw}},t}(),jw=function(){return jw=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new rA(e,i)})).inSingletonScope().whenTargetNamed(e)}class oA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class lA extends oA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const hA=Symbol.for("EnvContribution"),cA=Symbol.for("Global");var dA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,n){e(i,n,t)}};let gA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new lA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};gA=dA([qw(),pA(0,Qw(sA)),pA(0,Zw(hA)),uA("design:paramtypes",[Object])],gA);const fA=cs-1e-8;class mA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>fA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=cs)<0&&(n+=cs),(s%=cs)<0&&(s+=cs),ss;++o,a-=hs)g(a);else for(a=n-n%hs+hs,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const _A=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,vA={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},bA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let xA,SA,wA,AA,kA,MA;var CA,TA,EA,RA,PA,BA,IA,DA,LA;function OA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function FA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Es(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=cs:T>0&&0===r&&(T-=cs);const E=Math.ceil(Math.abs(T/(hs+.001))),R=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function jA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class qA extends KA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function ZA(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class JA{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function QA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new KA("linear",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new JA(s,n),t),s}function tk(t,e,i,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n)}class ek{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&tk(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:tk(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ik(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return QA(t,e);const s=new KA("basis",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new ek(s,n),t),s}function nk(t){return t<0?-1:1}function sk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(nk(r)+nk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function rk(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function ak(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class ok{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined2);break;case 3:ak(this,this._t0,rk(this,this._t0),!1!==this._lastDefined2)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,ak(this,rk(this,e=sk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:ak(this,this._t0,e=sk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined}}tryUpdateLength(){return this.context.tryUpdateLength()}}class lk extends ok{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function hk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return QA(t,e);const s=new KA("monotoneX",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new ok(s,n),t),s}function ck(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return QA(t,e);const s=new qA("monotoneY",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new lk(s,n),t),s}let dk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function uk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new KA("step",null!=n?n:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new dk(r,e,s),t),r}class pk{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){this.context.closePath()}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function gk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new KA("linear",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new pk(s,n),t),s}function fk(t,e,i){switch(e){case"linear":default:return QA(t,i);case"basis":return ik(t,i);case"monotoneX":return hk(t,i);case"monotoneY":return ck(t,i);case"step":return uk(t,.5,i);case"stepBefore":return uk(t,0,i);case"stepAfter":return uk(t,1,i);case"linearClosed":return gk(t,i)}}class mk extends yA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new mA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([bA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([bA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([bA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([bA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([bA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([bA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([bA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([bA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([bA.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const t=[];t[bA.M]=t=>`M${t[1]} ${t[2]}`,t[bA.L]=t=>`L${t[1]} ${t[2]}`,t[bA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[bA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[bA.A]=t=>{const e=[];zA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tMA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),jA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===IA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return us(t.p0.y-e.p1.y)}if(this.direction===IA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return us(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const yk=["l",0,0,0,0,0,0,0];function _k(t,e,i){const n=yk[0]=t[0];if("a"===n||"A"===n)yk[1]=e*t[1],yk[2]=i*t[2],yk[3]=t[3],yk[4]=t[4],yk[5]=t[5],yk[6]=e*t[6],yk[7]=i*t[7];else if("h"===n||"H"===n)yk[1]=e*t[1];else if("v"===n||"V"===n)yk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Ik=Object.assign(Object.assign({},kk),{points:[],cornerRadius:0}),Dk=Object.assign(Object.assign({},kk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Lk=Object.assign(Object.assign({},kk),{width:0,height:0,cornerRadius:0,length:0}),Ok=Object.assign(Object.assign({},kk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Fk=Object.assign(Object.assign(Object.assign({},kk),wk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),zk=Object.assign(Object.assign({},kk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Hk=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},kk),{fill:!0}),jk=Object.assign(Object.assign({},Hk),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});var Nk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Fk.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};Vk=Nk([qw()],Vk);var Wk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Uk=Symbol.for("TextMeasureContribution");let Gk=class extends Vk{};Gk=Wk([qw()],Gk);const Yk=new Uw;const $k=new class{},Xk=Symbol.for("CanvasFactory"),Kk=Symbol.for("Context2dFactory");function qk(t){return Yk.getNamed(Xk,$k.global.env)(t)}const Zk=1e-4,Jk=Math.sqrt(3),Qk=1/3;function tM(t){return t>-gM&&tgM||t<-gM}const iM=[0,0],nM=[0,0],sM=[0,0];function rM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function aM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function oM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function lM(t){return(t%=ds)<0&&(t+=ds),t}function hM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function cM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=ds);let d=Math.atan2(l,o);return d<0&&(d+=ds),d>=n&&d<=s||d+ds>=n&&d+ds<=s}function pM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(tM(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const mM=[-1,-1,-1],yM=[-1,-1];function _M(){const t=yM[0];yM[0]=yM[1],yM[1]=t}function vM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(tM(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Qk):Math.pow(i,Qk),n=n<0?-Math.pow(-n,Qk):Math.pow(n,Qk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Jk*Math.sin(e)))/(3*a),h=(-o+i*(n-Jk*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,mM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&_M(),p=oM(e,n,r,o,yM[0]),u>1&&(g=oM(e,n,r,o,yM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(tM(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,mM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=aM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);mM[0]=-l,mM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=ds-1e-4){n=0,s=ds;const e=r?1:-1;return a>=mM[0]+t&&a<=mM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=ds,s+=ds);let c=0;for(let e=0;e<2;e++){const i=mM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=ds+t),(t>=n&&t<=s||t+ds>=n&&t+ds<=s)&&(t>ls/2&&t<1.5*ls&&(e=-e),c+=e)}}return c}function SM(t){return Math.round(t/ls*1e8)/1e8%2*ls}function wM(t,e){let i=SM(t[0]);i<0&&(i+=ds);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=ds?s=i+ds:e&&i-s>=ds?s=i-ds:!e&&i>s?s=i+(ds-SM(i-s)):e&&i1&&(i||(h+=hM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;AM[0]=S,AM[1]=w,wM(AM,Boolean(a[6])),S=AM[0],w=AM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case bA.M:u=m,p=y,c=u,d=p;break;case bA.L:if(i){if(pM(c,d,m,y,e,n,s))return!0}else h+=hM(c,d,m,y,n,s)||0;c=m,d=y;break;case bA.C:if(i){if(dM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=vM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case bA.Q:if(i){if(cM(c,d,m,y,_,v,e,n,s))return!0}else h+=bM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case bA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=hM(c,d,o,l,n,s),i){if(uM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=xM(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case bA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(pM(u,p,o,p,e,n,s)||pM(o,p,o,l,e,n,s)||pM(o,l,u,l,e,n,s)||pM(u,l,u,p,e,n,s))return!0}else h+=hM(o,p,o,l,n,s),h+=hM(u,l,u,p,n,s);break;case bA.Z:if(i){if(pM(c,d,u,p,e,n,s))return!0}else h+=hM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TM=function(t,e){return function(i,n){e(i,n,t)}};let EM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=qk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:wk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new wr(Object.assign({defaultFontParams:{fontFamily:wk.fontFamily,fontSize:wk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+wr.ALPHABET_CHAR_SET+wr.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var RM;EM=MM([qw(),TM(0,Qw(sA)),TM(0,Zw(Uk)),TM(1,Qw(cA)),CM("design:paramtypes",[Object,Object])],EM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(RM||(RM={}));const PM=new Ls;let BM=class{constructor(){this.matrix=new Ls}init(t){return this.mode=RM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=RM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(PM.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(PM.a,PM.b,PM.c,PM.d,PM.e,PM.f),this}scale(t,e,i){return this.mode===RM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return PM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(PM.a,PM.b,PM.c,PM.d,PM.e,PM.f),this}translate(t,e){return this.mode===RM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===RM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};BM=MM([qw(),CM("design:paramtypes",[])],BM);const IM={arc:Mk,area:Ck,circle:Tk,line:Pk,path:Bk,symbol:Ok,text:Fk,rect:Dk,rect3d:Lk,polygon:Ik,richtext:zk,richtextIcon:jk,image:Hk,group:Ek,glyph:Rk},DM=Object.keys(IM);function LM(){return{arc:Object.assign({},IM.arc),area:Object.assign({},IM.area),circle:Object.assign({},IM.circle),line:Object.assign({},IM.line),path:Object.assign({},IM.path),symbol:Object.assign({},IM.symbol),text:Object.assign({},IM.text),rect:Object.assign({},IM.rect),rect3d:Object.assign({},IM.rect3d),polygon:Object.assign({},IM.polygon),richtext:Object.assign({},IM.richtext),richtextIcon:Object.assign({},IM.richtextIcon),image:Object.assign({},IM.image),group:Object.assign({},IM.group),glyph:Object.assign({},IM.glyph)}}function OM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const FM=new Array(60).fill(0).map((()=>LM()));class zM{constructor(){this._defaultTheme=FM.pop()||LM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?OM(this.userTheme,t.userTheme,!1):this.userTheme=mn(t.userTheme),OM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);DM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const HM=new zM;function jM(t,e){return t.glyphHost?jM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):HM.getTheme()}return null}(t)||HM.getTheme()}class NM{static GenAutoIncrementId(){return NM.auto_increment_id++}}NM.auto_increment_id=0;var VM=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class WM extends Ui{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=NM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return VM(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(qM(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=qM(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=qM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=qM(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=KM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(qM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(qM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,qM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):qM(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof $M))return void console.warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i=0&&t<=pn(this.rootTarget,"width")&&e>=0&&e<=pn(this.rootTarget,"height")?this.rootTarget:null,i}}const JM={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof UM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new XM(t,e))}},QM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class tC{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new ZM(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new YM,this.rootWheelEvent=new $M,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&tn(t)&&!fn(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class eC{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const iC=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},nC=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class sC extends Ui{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=KM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=KM.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||iC(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=nC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=KM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=nC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=iC(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=KM.now()-i>this.config.press.time&&nC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class aC{static Avaliable(){return!0}avaliable(){return aC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class oC{static Avaliable(){return!!$k.global.getRequestAnimationFrame()}avaliable(){return oC.Avaliable()}tick(t,e){$k.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var lC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(lC||(lC={}));class hC{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-hC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*hC.bounceIn(2*t):.5*hC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/ds*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*ds/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/ds*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*ds/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/ds*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*ds/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*ds/e)*.5+1}}}hC.quadIn=hC.getPowIn(2),hC.quadOut=hC.getPowOut(2),hC.quadInOut=hC.getPowInOut(2),hC.cubicIn=hC.getPowIn(3),hC.cubicOut=hC.getPowOut(3),hC.cubicInOut=hC.getPowInOut(3),hC.quartIn=hC.getPowIn(4),hC.quartOut=hC.getPowOut(4),hC.quartInOut=hC.getPowInOut(4),hC.quintIn=hC.getPowIn(5),hC.quintOut=hC.getPowOut(5),hC.quintInOut=hC.getPowInOut(5),hC.backIn=hC.getBackIn(1.7),hC.backOut=hC.getBackOut(1.7),hC.backInOut=hC.getBackInOut(1.7),hC.elasticIn=hC.getElasticIn(1,.3),hC.elasticOut=hC.getElasticOut(1,.3),hC.elasticInOut=hC.getElasticInOut(1,.3*1.5);const cC=new class{constructor(){this.id=NM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===RA.END?this.removeAnimate(e):e.status===RA.RUNNING||e.status===RA.INITIAL?(this.animateCount++,e.advance(t)):e.status===RA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class dC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class uC extends dC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let pC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cC;this.id=t,this.timeline=e,this.status=RA.INITIAL,this.tailAnimate=new gC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=fs(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&PA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:EA.ANIMATE_PLAY})}runCb(t){const e=new uC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===RA.RUNNING&&(this.status=RA.PAUSED)}resume(){this.status===RA.PAUSED&&(this.status=RA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new gC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===RA.RUNNING&&(this.status=RA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=RA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};pC.mode=PA.NORMAL,pC.interpolateMap=new Map;class gC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new fC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?hC[i]:i,s=this._addStep(e,null,n);return s.type=BA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?hC[i]:i,r=this._addStep(e,null,s);return r.type=BA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=BA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=BA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new fC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class fC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const mC=200,yC="cubicOut",_C=1e3,vC="quadInOut";var bC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(bC||(bC={}));const xC=[!1,!1,!1,!1],SC=[0,0,0,0],wC=t=>t?en(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(SC[0]=t[0],SC[2]=t[0],SC[1]=t[1],SC[3]=t[1],SC):t:t:0,AC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],kC=[1,2,3,0,1,2,3,0];function MC(t,e,i,n){for(;t>=ds;)t-=ds;for(;t<0;)t+=ds;for(;t>e;)e+=ds;AC[0].x=i,AC[1].y=i,AC[2].x=-i,AC[3].y=-i;const s=Math.ceil(t/hs)%4,r=Math.ceil(e/hs)%4;if(n.add(gs(t)*i,ys(t)*i),n.add(gs(e)*i,ys(e)*i),s!==r||e-t>ls){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new As(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new As(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new As(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=CC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class DC extends dC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:EA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:EA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:EA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class LC extends DC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=$k.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class OC extends DC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=$k.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class FC extends dC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=ds-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+ls/2;i.alpha>ds;)i.alpha-=ds;i.alpha=ds-i.alpha,i.zIndex=-1e4*i.z}}class zC extends dC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class HC extends dC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?hC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function jC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function NC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{Un(e,n)&&Un(i,s)||t.push(e,i,n,s,n,s)};function $C(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function XC(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&rn(t.x)&&rn(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),QC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},tT=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Cs;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return QC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return QC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);tT(s[0],n,i),tT(s[1],e-n,i)}};var eT={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const iT={};for(const t in eT)fn(eT,t)&&(iT[eT[t]]=t);const nT={to:{},get:{}};function sT(t,e,i){return Math.min(Math.max(e,t),i)}function rT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}nT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=nT.get.hsl(t,n),i="hsl";break;case"hwb":e=nT.get.hwb(t,n),i="hwb";break;default:e=nT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},nT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=eT[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=sT(e[n],0,255);return e[3]=sT(e[3],0,1),e},nT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=sT(parseFloat(i[2]),0,100),e[2]=sT(parseFloat(i[3]),0,100),e[3]=sT(isNaN(t)?1:t,0,1),e}return null},nT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=sT(parseFloat(i[2]),0,100),e[2]=sT(parseFloat(i[3]),0,100),e[3]=sT(isNaN(t)?1:t,0,1),e}return null},nT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},nT.to.keyword=function(t){return iT[t.slice(0,3)]};const aT=nT;var oT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(oT||(oT={}));class lT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===oT.Color1){let e=lT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=nT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];lT.store1[t]=s,lT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=lT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=nT.get(t),n&&n.value){const e=n.value;lT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],lT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===oT.Color1){if(lT.store1[t])return;lT.store1[t]=i,lT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(lT.store255[t])return;lT.store255[t]=i,lT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function hT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function cT(t,e,i,n,s){if(!t||!e)return t&&hT(t)||e&&hT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=lT.Get(t,oT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=lT.Get(e,oT.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:hT(a)})))});return o?cT(r,l,i,n,s):cT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:pT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:pT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:pT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),hT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}lT.store255={},lT.store1={};const dT=[0,0,0,0],uT=[0,0,0,0];function pT(t,e,i){return lT.Get(t,oT.Color255,dT),lT.Get(e,oT.Color255,uT),`rgba(${Math.round(dT[0]+(uT[0]-dT[0])*i)},${Math.round(dT[1]+(uT[1]-dT[1])*i)},${Math.round(dT[2]+(uT[2]-dT[2])*i)},${dT[3]+(uT[3]-dT[3])*i})`}const gT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=cT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},fT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?$C(t):[],s=$C(e);i&&n&&(i.fromTransform&&XC(n,i.fromTransform.clone().getInverse()),XC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},yT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],_T=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!yT.includes(s))return;const r=e[s];Xi(r)||Xi(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?lT.Get(t[s],oT.Color255):t[s],to:"string"==typeof r?lT.Get(r,oT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class vT extends dC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;fT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&gT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const bT=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=mT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=_T(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new vT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:_C,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:vC)),c};class xT extends dC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;fT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&gT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ST=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>EC.includes(t))(i)||(e[i]=t[i])})),e},wT=(t,e,i)=>{const n=ST(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=$k.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},AT=(t,e,i)=>{const n=[],s=i?null:ST(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:ST(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=qC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push($k.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=qC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push($k.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=qC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push($k.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return ZC(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ZC(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push($k.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:JC(i)}];const n=[];return tT(i,e,n),n})(t,e).forEach((t=>{n.push($k.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&rn(t.x)&&rn(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return tT(r,e,h),h})(t,e).forEach((t=>{n.push($k.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=$C(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push($k.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push($k.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&wT(t,n,e),n};class MT{static GetImage(t,e){var i;let n=MT.cache.get(t);n?"fail"===n.loadState?$k.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&$k.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},MT.cache.set(t,n),n.dataPromise=$k.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=MT.cache.get(t);n?"fail"===n.loadState?$k.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&$k.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},MT.cache.set(t,n),n.dataPromise=$k.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=MT.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},MT.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=$k.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=$k.global.loadBlob(t):"json"===e&&(i.dataPromise=$k.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}MT.cache=new Map;const CT=new Ls,TT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],ET=["x","y"],RT=["scaleX","scaleY"],PT=["angle"],BT=new As;class IT extends WM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Ts,this._updateTag=CA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=jM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;BT.x=i+e,BT.y=n+s}else BT.x=i,BT.y=n;return BT}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;$k.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return $k.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Ls),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&CA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&CA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&CA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&CA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&CA.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&CA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=CA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===TA.GLOBAL){const i=new As(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){$k.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!Xi(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:mC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:yC)}else this.setAttributes(t,!1,{type:EA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();fn(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=CA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=CA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=CA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&CA.UPDATE_SHAPE_AND_BOUNDS)===CA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=CA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=CA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=CA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=CA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=CA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=vk.x,y:e=vk.y,scaleX:i=vk.scaleX,scaleY:n=vk.scaleY,angle:s=vk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=gs(a),f=ys(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(vk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=CT.setValue(a.a,a.b,a.c,a.d,a.e,a.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),$k.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:EA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:EA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=cT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=cT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=cT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return jM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:$k.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return tn(t,!0)?this.pathProxy=(new mk).fromString(t):this.pathProxy=new mk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",on(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(MT.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new XM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}IT.mixin(JM);var DT=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function LT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let OT=0;function FT(){return OT++}const zT=FT(),HT=FT(),jT=FT(),NT=FT(),VT=FT(),WT=FT(),UT=FT(),GT=FT(),YT=FT(),$T=FT(),XT=FT(),KT=FT(),qT=FT(),ZT=FT(),JT=FT(),QT=FT(),tE=Symbol.for("GraphicService"),eE=Symbol.for("GraphicCreator");var iE;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(iE||(iE={}));let nE=class t extends IT{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=WT,this._childUpdateTag=CA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new zM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new zM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===TA.GLOBAL){const i=new As(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&CA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;$k.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return $k.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=jM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=$k.graphicService.updateGroupAABBBounds(t,jM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=wC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=CA.CLEAR_BOUNDS,this._childUpdateTag&=CA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=CA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&CA.UPDATE_BOUNDS||(this._childUpdateTag|=CA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),$k.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),$k.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,$k.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{$k.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),$k.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&CA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=$k.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const sE=Symbol.for("LayerHandlerContribution");class rE extends nE{get offscreen(){return this.layerHandler.offscreen}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=Yk.get(sE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new zM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{$k.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{$k.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var aE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lE=function(t,e){return function(i,n){e(i,n,t)}};let hE=class{constructor(t){this.global=t,this.layerMap=new Map,this.staticLayerCountInEnv=t.getStaticCanvasCount(),this.dynamicLayerCountInEnv=t.getDynamicCanvasCount()}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};const i=new rE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}};hE=aE([qw(),lE(0,Qw(cA)),oE("design:paramtypes",[Object])],hE);var cE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uE=function(t,e){return function(i,n){e(i,n,t)}};const pE=Symbol.for("Window"),gE=Symbol.for("WindowHandlerContribution");let fE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new lA(["x","y","width","height"])},this._uid=NM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Yk.getNamed(gE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};cE([nA(),dE("design:type",Function),dE("design:paramtypes",[]),dE("design:returntype",void 0)],fE.prototype,"postInit",null),fE=cE([qw(),uE(0,Qw(cA)),dE("design:paramtypes",[Object])],fE);const mE=Symbol.for("TransformUtil"),yE=Symbol.for("GraphicUtil"),_E=Symbol.for("LayerService");var vE=new Gw((t=>{t(gA).toSelf().inSingletonScope(),t(cA).toService(gA),t(fE).to(fE),t(pE).toService(fE),t(EM).toSelf().inSingletonScope(),t(yE).toService(EM),t(BM).toSelf().inSingletonScope(),t(mE).toService(BM),t(hE).toSelf().inSingletonScope(),t(_E).toService(hE)}));function bE(t){return!!t}function xE(t,e){let i;return i=en(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function SE(t,e){return t*e>0}function wE(t,e,i,n){return t*e>0&&i>0&&n>0}function AE(t,e){return t*e>0}function kE(t,e,i,n){return t*e>0&&i>0&&n>0}function ME(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=jM(t,null==r?void 0:r.theme)[t.type],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible}=t.attribute,m=SE(d,u),y=AE(d,g),_=bE(h),v=xE(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return jA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function CE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uR*R+P*P&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function EE(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=us(l-o),c=l>o;let d=!1;if(s=ds-os)e.moveTo(i+s*gs(o),n+s*ys(o)),e.arc(i,n,s,o,l,!c),r>os&&(e.moveTo(i+r*gs(l),n+r*ys(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*gs(f),T=s*ys(f),E=r*gs(y),R=r*ys(y);let P,B,I,D;if((A>os||w>os)&&(P=s*gs(m),B=s*ys(m),I=r*gs(_),D=r*ys(_),hos){const t=ms(v,k),r=ms(b,k),o=TE(I,D,C,T,s,t,Number(c)),l=TE(P,B,E,R,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,ps(o.y01,o.x01),ps(o.y11,o.x11),!c),e.arc(i,n,s,ps(o.cy+o.y11,o.cx+o.x11),ps(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,ps(l.y11,l.x11),ps(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*gs(ps(l.y01,l.x01)),n+l.cy+r*ys(ps(l.y01,l.x01))):e.moveTo(i+P,n+s*ys(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>os)||g<.001)!a||a[1]?e.lineTo(i+E,n+R):e.moveTo(i+E,n+R),d=!0;else if(M>os){const t=ms(S,M),s=ms(x,M),o=TE(E,R,P,B,r,-s,Number(c)),l=TE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,ps(o.y01,o.x01),ps(o.y11,o.x11),!c),e.arc(i,n,r,ps(o.cy+o.y11,o.cx+o.x11),ps(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,ps(l.y11,l.x11),ps(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*gs(ps(l.y01,l.x01)),n+l.cy+t*ys(ps(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+R):e.moveTo(i+E,n+R),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*gs(_),n+r*ys(_))}return a?a[3]&&e.lineTo(i+s*gs(l),n+s*gs(l)):e.closePath(),d}class RE{static GetCanvas(){try{return RE.canvas||(RE.canvas=$k.global.createCanvas({})),RE.canvas}catch(t){return null}}static GetCtx(){if(!RE.ctx){const t=RE.GetCanvas();RE.ctx=t.getContext("2d")}return RE.ctx}}class PE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=RE.GetCanvas(),n=RE.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=PE.dataMap.get(i);return n||(n=new PE(t,e),PE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){PE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return PE.dataMap.get(t)}}PE.dataMap=new Map;class BE{static GetSize(t){for(let e=0;e=t)return BE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=BE.GenKey(t,e,i,n,s),l=BE.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=BE.GenKey(t,e,i,n,s);BE.cache[l]?BE.cache[l].push({width:a,height:o,pattern:r}):BE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}BE.cache={},BE.ImageSize=[20,40,80,160,320,640,1280,2560];const IE=Symbol.for("ArcRenderContribution"),DE=Symbol.for("AreaRenderContribution"),LE=Symbol.for("CircleRenderContribution"),OE=Symbol.for("GroupRenderContribution"),FE=Symbol.for("ImageRenderContribution"),zE=Symbol.for("PathRenderContribution"),HE=Symbol.for("PolygonRenderContribution"),jE=Symbol.for("RectRenderContribution"),NE=Symbol.for("SymbolRenderContribution"),VE=Symbol.for("TextRenderContribution"),WE=Symbol.for("InteractiveSubRenderContribution");var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},YE=function(t,e){return function(i,n){e(i,n,t)}};let $E=class{constructor(t){this.arcRenderContribitions=t,this.numberType=zT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=us(d-c),p=d>c;let g=!1;if(sos||M>os)&&(D=s*gs(v),L=s*ys(v),O=r*gs(x),F=r*ys(x),uos){const t=ms(S,T),r=ms(w,T),a=TE(O,F,R,P,s,t,Number(p)),o=TE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,ps(o.y11,o.x11),ps(o.y01,o.x01),!p)}}else e.moveTo(i+R,n+P);if(!(r>os)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>os){const t=ms(k,E),s=ms(A,E),a=TE(B,I,D,L,r,-s,Number(p)),o=TE(R,P,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,ps(a.y01,a.x01),ps(a.y11,a.x11),!p);const t=ps(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*gs(x),n+r*ys(x));return g}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,fillOpacity:p=l.fillOpacity,lineWidth:g=l.lineWidth,strokeOpacity:f=l.strokeOpacity,visible:m=l.visible,x:y=l.x,y:_=l.y}=t.attribute,v=SE(u,p),b=AE(u,f),x=bE(h),S=xE(d,g);if(!t.valid||!m)return;if(!(x||S||c))return;if(!(v||b||a||o||c))return;const{outerRadius:w=l.outerRadius,innerRadius:A=l.innerRadius,cap:k=l.cap,forceShowCap:M=l.forceShowCap}=t.attribute;let C=!1;const{isFullStroke:T,stroke:E}=(t=>{var e;let i=!0;if(Yi(t,!0)){for(let n=0;n<4;n++)xC[n]=t,i&&(i=!(null!==(e=xC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)xC[e]=!!t[e],i&&(i=!!xC[e]);else xC[0]=!1,xC[1]=!1,xC[2]=!1,xC[3]=!1;return{isFullStroke:i,stroke:xC}})(d);if(x||T||c){if(e.beginPath(),EE(t,e,i,n,w,A),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===LA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}C=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),x&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,y-i,_-n,l),e.fill())),S&&T&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,y-i,_-n,l),e.stroke()))}if(!T&&S){if(e.beginPath(),EE(t,e,i,n,w,A,E),!C){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===LA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}C=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)}))}o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())}if(k&&M){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(us(h-r)>=ds-os){e.beginPath();const r=Math.abs(w-A)/2/w,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,n,w,A,d,d+r),!C){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===LA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}C=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)}))}if(x){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=ds;for(;i>ds;)i-=ds;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),cT(o.color,l.color,h,!1)}(0,0,h,s);a||SE&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=r,e.fill())}}S&&(o||b&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=jM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};$E=UE([qw(),YE(0,Qw(sA)),YE(0,Zw(IE)),GE("design:paramtypes",[Object])],$E);var XE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qE=function(t,e){return function(i,n){e(i,n,t)}};let ZE=class{constructor(t){this.circleRenderContribitions=t,this.numberType=NT}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=SE(y,f),w=AE(y,m),A=bE(h),k=xE(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};ZE=XE([qw(),qE(0,Qw(sA)),qE(0,Zw(LE)),KE("design:paramtypes",[Object])],ZE);const JE=["radius","startAngle","endAngle",...TT];class QE extends IT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=NT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=jM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=$k.graphicService.updateCircleAABBBounds(i,jM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=wC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function eR(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function iR(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class nR{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=QT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=jM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=jM(this).text,n=$k.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=eR(c,s),e=iR(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=eR(c,s),_=iR(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=jM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const g=$k.graphicUtil.textMeasure,f=new nR(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).text[t]}needUpdateTags(t){for(let e=0;e{YR[t.type]=t}));const $R=["symbolType","size",...TT];let XR=class t extends IT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=JT}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return en(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=jM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=YR[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new mk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/fs(r,a);return s.transform(0,0,o,o),this._parsedPath=new GR(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=jM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=$k.graphicService.updateSymbolAABBBounds(i,jM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=wC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).symbol[t]}needUpdateTags(t){for(let e=0;e<$R.length;e++){const i=$R[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$R.length;e++)if(t===$R[e])return!0;return!1}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=en(e)?e:[e,e];return t.path?(new mk).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new mk).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}};XR.userSymbolMap={};const KR=["segments","points","curveType",...TT];let qR=class t extends IT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=TC(i,n,e))}doUpdateAABBBounds(){const t=jM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateLineAABBBounds(e,jM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const ZR=["width","height","cornerRadius",...TT];class JR extends IT{constructor(t){super(t),this.type="rect",this.numberType=KT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=jM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateRectAABBBounds(e,jM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).rect[t]}needUpdateTags(t){for(let e=0;e{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=$k.graphicService.updateGlyphAABBBounds(this.attribute,jM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new eP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const iP={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},nP=!0,sP=!1,rP=/\w|\(|\)/,aP=/[.?!,;:/,。?!、;:]/,oP=/\S/;function lP(t,e,i,n,s){if(!e||e<=0)return 0;const r=$k.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=function(t,e){let i=e;for(;rP.test(t[i-1])&&rP.test(t[i])||aP.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function hP(t,e){const i=$k.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class cP{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=iP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class dP{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=hP(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=hP(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=lP(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=hP(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||sP;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||nP;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=lP(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=hP(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const uP=["width","height","image",...TT];class pP extends IT{constructor(t){super(t),this.type="image",this.numberType=UT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=jM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateImageAABBBounds(e,jM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Hk[t]}needUpdateTags(t){for(let e=0;e{if(en(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=wC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Hk.width,height:e=Hk.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class fP{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof gP?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=iP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof dP){const e=oP.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof gP)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=hP("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof gP)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof gP)break;const{width:n}=hP("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof gP?t.width:t.getWidthWithEllips(this.direction)})),e}}class mP{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=iP[this.direction]}store(t){if(t instanceof gP){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new fP(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof gP?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=lP(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new dP(i,t.newLine,t.character),new dP(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const yP=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...TT];class _P extends IT{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ZT}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:zk.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:zk.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:zk.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:zk.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:zk.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:zk.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:zk.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:zk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=jM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateRichTextAABBBounds(e,jM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return zk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new mP(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const vP=["path","customPath",...TT];class bP extends IT{constructor(t){super(t),this.type="path",this.numberType=YT}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=jM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof mk?e.path:(Xi(this.cache)&&this.doUpdatePathShape(),this.cache instanceof mk?this.cache:t.path)}doUpdateAABBBounds(){const t=jM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updatePathAABBBounds(e,jM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;tn(t.path,!0)?this.cache=(new mk).fromString(t.path):t.customPath&&(this.cache=new mk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new SP(Object.assign({},this.attribute))}}const wP=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...TT];class AP extends IT{constructor(t){super(t),this.type="arc",this.numberType=zT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=jM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(rn(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=jM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Bs(e),i=e+r,n&&us(r)os&&o>os)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=jM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=_s(n*n+s*s)}=this.attribute,o=us(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>os&&a>os){const i=e>t?1:-1;let r=xs(Number(a)/s*ys(u)),o=xs(Number(a)/n*ys(u));return(p-=2*r)>os?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>os?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=jM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=$k.graphicService.updateArcAABBBounds(i,jM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=wC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=ds-os)o.moveTo(0+s*gs(e),0+s*ys(e)),o.arc(0,0,s,e,i,!a),n>os&&(o.moveTo(0+n*gs(i),0+n*ys(i)),o.arc(0,0,n,i,e,a));else{const t=s*gs(e),r=s*ys(e),l=n*gs(i),h=n*ys(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new AP(Object.assign({},this.attribute))}}class kP extends AP{constructor(t){super(t),this.type="arc3d",this.numberType=HT}doUpdateAABBBounds(){const t=jM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateArc3dAABBBounds(e,jM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const MP=["points","cornerRadius",...TT];class CP extends IT{constructor(t){super(t),this.type="polygon",this.numberType=$T}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=jM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updatePolygonAABBBounds(e,jM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=TC(i,n,e))}getDefaultAttribute(t){return jM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new CP(Object.assign({},this.attribute))}}class TP extends CP{constructor(t){super(t),this.type="pyramid3d",this.numberType=XT}doUpdateAABBBounds(){const t=jM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updatePyramid3dAABBBounds(e,jM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var EP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RP=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};RP=EP([qw()],RP);var PP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const BP=Symbol.for("RectBoundsContribution");let IP=class extends RP{};IP=PP([qw()],IP);var DP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const LP=Symbol.for("SymbolBoundsContribution");let OP=class extends RP{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;LT(i,n+r+o/2,!0,a)}return i}};OP=DP([qw()],OP);var FP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const zP=Symbol.for("CircleBoundsContribution");let HP=class extends RP{};HP=FP([qw()],HP);var jP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const NP=Symbol.for("ArcBoundsContribution");let VP=class extends RP{};VP=jP([qw()],VP);var WP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const UP=Symbol.for("PathBoundsContribution");let GP=class extends RP{};GP=WP([qw()],GP);class YP{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return YP.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZP=function(t,e){return function(i,n){e(i,n,t)}};function JP(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function QP(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function tB(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function eB(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),JP(t,t,[s+o,r+l,a+h]),JP(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),JP(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=XP.allocate(),n=[0,0];if(y){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}JP(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),JP(i,i,[-n[0],-n[1],0]),tB(t,t,i)}}let iB=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new lA(["graphic"]),onSetStage:new lA(["graphic","stage"]),onRemove:new lA(["graphic"]),onAddIncremental:new lA(["graphic","group","stage"]),onClearIncremental:new lA(["graphic","group","stage"]),beforeUpdateAABBBounds:new lA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new lA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Ts,this.tempAABBBounds2=new Ts}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new mA(t);return jA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),Ms(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>ds-os?i.set(-a,-a,a,a):MC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=os?i.set(0,0,0,0):Math.abs(a-o)>ds-os?i.set(-s,-s,s,s):(MC(o,a,s,i),MC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(en(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){LT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){LT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Ms(e,e,s.transMatrix)}};iB=KP([qw(),ZP(0,Qw(eE)),ZP(1,Qw(sA)),ZP(1,Zw(BP)),ZP(2,Qw(sA)),ZP(2,Zw(LP)),ZP(3,Qw(sA)),ZP(3,Zw(zP)),ZP(4,Qw(sA)),ZP(4,Zw(NP)),ZP(5,Qw(sA)),ZP(5,Zw(UP)),qP("design:paramtypes",[Object,Object,Object,Object,Object,Object])],iB);class nB extends nE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const sB=["heightLimit","lineClamp"];class rB extends rR{_isValid(){const{text:t}=this.attribute;return en(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=jM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=$k.graphicUtil.textMeasure,f=new nR(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=XP.allocate(),s=XP.allocate();eB(s,t,e),tB(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),XP.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,y,_,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function AB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),kB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=IA.ROW:"y"===n?c=IA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CB=class extends wB{constructor(){super(...arguments),this.numberType=GT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const m=null!==(f=this.z)&&void 0!==f?f:0;AB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:m}),u.cache&&!en(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,y-c,_-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,y-c,_-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=SE(d,u),y=AE(d,p),_=bE(h),v=xE(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined),s=fk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=fk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],ms(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function TB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),EB(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),EB(t,l,1,n),o=!1):o=!0}t.closePath()}function EB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=GA(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}CB=MB([qw()],CB);var RB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BB=function(t,e){return function(i,n){e(i,n,t)}};function IB(t,e,i){switch(e){case"linear":default:return QA(t,i);case"basis":return ik(t,i);case"monotoneX":return hk(t,i);case"monotoneY":return ck(t,i);case"step":return uk(t,.5,i);case"stepBefore":return uk(t,0,i);case"stepAfter":return uk(t,1,i);case"linearClosed":return gk(t,i)}}let DB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=jM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=SE(y,m),A=bE(f),k=xE(b,x),M=AE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=IB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=IB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const r=IB(i,n),a=IB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],ms(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=jM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?IA.ROW:IA.COLUMN,Number.isFinite(c)||(o=IA.COLUMN),Number.isFinite(d)||(o=IA.ROW);const u=i*(o===IA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===LA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:m=0,x:y=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,m-h,y-c,o),t.fill())),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;en(i)&&i[0]&&!1===i[1]&&(t.beginPath(),AB(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,m-h,y-c,o),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===LA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1}};DB=RB([qw(),BB(0,Qw(sA)),BB(0,Zw(DE)),PB("design:paramtypes",[Object])],DB);var LB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FB=function(t,e){return function(i,n){e(i,n,t)}};let zB=class extends wB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=jM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=SE(f,p),w=AE(f,g),A=bE(d),k=xE(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)jA(t.pathShape.commandList,e,i,n,1,1,x);else{jA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};zB=LB([qw(),FB(0,Qw(sA)),FB(0,Zw(zE)),OB("design:paramtypes",[Object])],zB);const HB=ls/2;function jB(t,e,i,n,s,r){let a;if(rn(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],v=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!Rn(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-HB,0,!1)}if(t.lineTo(_[0],_[1]),!Rn(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,HB,!1)}if(t.lineTo(v[0],v[1]),!Rn(v,b)){const e=v[0],i=v[1]-u[3];t.arc(e,i,u[3],HB,ls,!1)}if(t.lineTo(g[0],g[1]),!Rn(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],ls,ls+HB,!1)}return t.closePath(),t}var NB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:_=l.strokeOpacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=wE(f,m,u,p),w=kE(f,_,u,p),A=bE(h),k=xE(d,y);if(!t.valid||!v)return;if(!(A||k||c))return;if(!(S||w||a||o||c))return;0===g||en(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),jB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const M={doFill:A,doStroke:k};this._rectRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o,M)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),M.doFill&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),M.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};UB=NB([qw(),WB(0,Qw(sA)),WB(0,Zw(jE)),VB("design:paramtypes",[Object])],UB);var GB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$B=function(t,e){return function(i,n){e(i,n,t)}};let XB=class extends wB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=JT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=SE(f,p),A=AE(f,g),k=bE(d),M=xE(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};XB=GB([qw(),$B(0,Qw(sA)),$B(0,Zw(NE)),YB("design:paramtypes",[Object])],XB);var KB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZB=function(t,e){return function(i,n){e(i,n,t)}};let JB=class extends wB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=QT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=SE(f,p),C=AE(f,g),T=bE(d),E=xE(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const R=!b,P=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===LA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),R&&this.transformUseContext2d(t,h,P,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,P);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,P)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,P),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,P,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,P);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,P))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,P),this.drawUnderLine(_,v,t,i,n+r,P,h,e)))}R&&this.restoreTransformUseContext2d(t,h,P,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=eR(l,g),m=iR(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=eR(h,a),f=iR("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};JB=KB([qw(),ZB(0,Qw(sA)),ZB(0,Zw(VE)),qB("design:paramtypes",[Object])],JB);var QB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tI=class{};function eI(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aI=function(t,e){return function(i,n){e(i,n,t)}};let oI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=$T}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:_=l.visible,x:v=l.x,y:b=l.y}=t.attribute,x=SE(y,p),S=AE(y,f),w=bE(c),A=xE(d,m);t.valid&&_&&(w||A||g)&&(x||S||a||o||g)&&(e.beginPath(),u<=0||en(u)&&u.every((t=>0===t))?eI(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)eI(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=nI(l,y,_,c,d),S=nI(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=iI(w,A),M=nI(l,iI(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,w,A,x,S,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),w&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,v-i,b-n,l),e.fill())),A&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,w,A,x,S,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};oI=sI([qw(),aI(0,Qw(sA)),aI(0,Zw(HE)),rI("design:paramtypes",[Object])],oI);var lI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cI=function(t,e){return function(i,n){e(i,n,t)}};const dI=["","repeat-x","repeat-y","repeat"];let uI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=UT}drawShape(t,e,i,n,s,r,a){const o=jM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=SE(d,u),_=bE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,dI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=jM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};uI=lI([qw(),cI(0,Qw(sA)),cI(0,Zw(FE)),hI("design:paramtypes",[Object])],uI);const pI=Symbol.for("IncrementalDrawContribution"),gI=Symbol.for("ArcRender"),fI=Symbol.for("Arc3dRender"),mI=Symbol.for("AreaRender"),yI=Symbol.for("CircleRender"),_I=Symbol.for("GraphicRender"),vI=Symbol.for("GroupRender"),bI=Symbol.for("LineRender"),xI=Symbol.for("PathRender"),SI=Symbol.for("PolygonRender"),wI=Symbol.for("RectRender"),AI=Symbol.for("Rect3DRender"),kI=Symbol.for("SymbolRender"),MI=Symbol.for("TextRender"),CI=Symbol.for("RichTextRender"),TI=Symbol.for("Pyramid3dRender"),EI=Symbol.for("GlyphRender"),RI=Symbol.for("ImageRender"),PI=Symbol.for("RenderSelector"),BI=Symbol.for("DrawContribution");function II(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function DI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(en(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const LI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return qk(Object.assign({nativeCanvas:$k.global.createCanvas(t)},t));const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr};return qk(Object.assign({nativeCanvas:$k.global.createCanvas(e)},e))}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};var OI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zI=function(t,e){return function(i,n){e(i,n,t)}};let HI=class{constructor(){this.time=LA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=jM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};HI=OI([qw()],HI);let jI=class{constructor(t){this.subRenderContribitions=t,this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};jI=OI([qw(),zI(0,Qw(sA)),zI(0,Zw(WE)),FI("design:paramtypes",[Object])],jI);let NI=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=LI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return LI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,ds),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};NI=OI([qw()],NI);var VI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WI=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=II(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),EE(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=II(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),EE(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};WI=VI([qw()],WI);let UI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};UI=VI([qw()],UI);let GI=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};GI=VI([qw()],GI);var YI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $I=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=II(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=II(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};$I=YI([qw()],$I);let XI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};XI=YI([qw()],XI);let KI=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};KI=YI([qw()],KI);var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};ZI=qI([qw()],ZI);var JI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let QI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=jM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};QI=JI([qw()],QI);var tD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eD=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=II(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||en(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),jB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=II(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||en(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),jB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};eD=tD([qw()],eD);let iD=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};iD=tD([qw()],iD);let nD=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};nD=tD([qw()],nD);let sD=class{constructor(){this.time=LA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};sD=tD([qw()],sD);let rD=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};rD=tD([qw()],rD);var aD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let oD=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=II(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=II(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};oD=aD([qw()],oD);class lD extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}}class hD extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}}var cD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uD=function(t,e){return function(i,n){e(i,n,t)}};const pD=Symbol.for("RenderService");let gD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};gD=cD([qw(),uD(0,Qw(BI)),dD("design:paramtypes",[Object])],gD);var fD=new Gw((t=>{t(gD).toSelf(),t(pD).toService(gD)})),mD=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function yD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return mD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function vD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var bD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const xD=Symbol.for("PickItemInterceptor");let SD=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===HT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=ds;for(;o<0;)o+=ds;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};SD=bD([qw()],SD);var wD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kD=function(t,e){return function(i,n){e(i,n,t)}};const MD=Symbol.for("PickerService");let CD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ls(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=XP.allocate();if(QP(i,e),a){if(i){const t=XP.allocate();r.modelMatrix=tB(t,a,i),XP.free(i)}}else QP(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new As(e.x,e.y),a=jM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new As(e.x,e.y);l.transformPoint(r,r);const a=jM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&XP.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),$P.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};CD=wD([qw(),kD(0,Qw(cA)),kD(1,Qw(sA)),kD(1,Zw(xD)),AD("design:paramtypes",[Object,Object])],CD);var TD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ED=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RD=function(t,e){return function(i,n){e(i,n,t)}};const PD=Symbol.for("GlobalPickerService");let BD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new Ls(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new As(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function ID(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function DD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}BD=TD([qw(),RD(0,Qw(cA)),ED("design:paramtypes",[Object])],BD);class LD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=XP.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=XP.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zD=[0,0,0],HD=new Ls(1,0,0,1,0,0);let jD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},bk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Sk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},wk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ls(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ls(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ls(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return $P.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=ds;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&BE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(DD(zD,[t,e,i],this.modelMatrix),t=zD[0],e=zD[1],i=zD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(DD(zD,[t,e,i],this.modelMatrix),t=zD[0],e=zD[1],i=zD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(DD(zD,[e,i,n],this.modelMatrix),e=zD[0],i=zD[1],n=zD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$k.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=$k.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:wk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:wk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(DD(zD,[e,i,n],this.modelMatrix),e=zD[0],i=zD[1],n=zD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=DI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=II(this,l,this.dpr),r.strokeStyle=DI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=tR(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=tR(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(HD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>$P.free(t))),this.stack.length=0}};jD.env="browser",jD=OD([qw(),FD("design:paramtypes",[Object,Number])],jD);var ND=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const WD={WIDTH:500,HEIGHT:500,DPR:1};let UD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=WD.WIDTH,height:n=WD.HEIGHT,dpr:s=WD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=$k.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new jD(this,this._dpr),this._id=e.id,this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};UD.env="browser",UD=ND([qw(),VD("design:paramtypes",[Object])],UD);const GD=Symbol.for("CanvasArcPicker"),YD=Symbol.for("CanvasArc3dPicker"),$D=Symbol.for("CanvasAreaPicker"),XD=Symbol.for("CanvasCirclePicker"),KD=Symbol.for("CanvasImagePicker"),qD=Symbol.for("CanvasLinePicker"),ZD=Symbol.for("CanvasPathPicker"),JD=Symbol.for("CanvasRectPicker"),QD=Symbol.for("CanvasRect3dPicker"),tL=Symbol.for("CanvasSymbolPicker"),eL=Symbol.for("CanvasTextPicker"),iL=Symbol.for("CanvasPolygonPicker"),nL=Symbol.for("CanvasPyramid3dPicker"),sL=Symbol.for("CanvasRichTextPicker"),rL=Symbol.for("CanvasGlyphPicker"),aL=Symbol.for("CanvasPickerContribution"),oL=Symbol.for("MathArcPicker"),lL=Symbol.for("MathAreaPicker"),hL=Symbol.for("MathCirclePicker"),cL=Symbol.for("MathLinePicker"),dL=Symbol.for("MathPathPicker"),uL=Symbol.for("MathRectPicker"),pL=Symbol.for("MathSymbolPicker"),gL=Symbol.for("MathTextPicker"),fL=Symbol.for("MathPolygonPicker"),mL=Symbol.for("MathGlyphPicker"),yL=Symbol.for("MathPickerContribution");var _L=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bL=function(t,e){return function(i,n){e(i,n,t)}};let xL=class extends CD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new UD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const AL=new Ls(1,0,0,1,0,0),kL={x:0,y:0};let ML=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ls(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ls(1,0,0,1,0,0),this.path=new mk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return $P.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},kL),function(t,e,i){return kM(t,0,!1,e,i)}(this.path.commandList,kL.x,kL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},kL);const i=II(this,this.lineWidth,this.dpr);return function(t,e,i,n){return kM(t,e,!0,i,n)}(this.path.commandList,i,kL.x,kL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(AL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>$P.free(t))),this.stack.length=0}};ML=SL([qw(),wL("design:paramtypes",[Object,Number])],ML);var CL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EL=function(t,e){return function(i,n){e(i,n,t)}};let RL=class extends CD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new ML(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};CL([nA(),TL("design:type",Function),TL("design:paramtypes",[]),TL("design:returntype",void 0)],RL.prototype,"init",null),RL=CL([qw(),EL(0,Qw(sA)),EL(0,Zw(yL)),EL(1,Qw(cA)),EL(2,Qw(sA)),EL(2,Zw(xD)),TL("design:paramtypes",[Object,Object,Object])],RL);var PL=new Gw((t=>{t(xL).toSelf().inSingletonScope(),t(RL).toSelf().inSingletonScope(),t(MD).toService(xL),t(BD).toSelf().inSingletonScope(),t(PD).toService(BD),t(SD).toSelf().inSingletonScope(),t(xD).toService(SD),aA(t,xD)})),BL=new Gw((t=>{t(iB).toSelf().inSingletonScope(),t(tE).toService(iB),t(IP).toSelf().inSingletonScope(),t(BP).toService(IP),aA(t,BP),t(OP).toSelf().inSingletonScope(),t(LP).toService(OP),aA(t,LP),t(HP).toSelf().inSingletonScope(),t(zP).toService(HP),aA(t,zP),t(VP).toSelf().inSingletonScope(),t(NP).toService(VP),aA(t,NP),t(GP).toSelf().inSingletonScope(),t(UP).toService(GP),aA(t,UP),t(eE).toConstantValue(vB)}));const IL=Symbol.for("AutoEnablePlugins"),DL=Symbol.for("PluginService");var LL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FL=function(t,e){return function(i,n){e(i,n,t)}};let zL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Yk.isBound(IL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};zL=LL([qw(),FL(0,Qw(sA)),FL(0,Zw(IL)),OL("design:paramtypes",[Object])],zL);var HL=new Gw((t=>{t(zL).toSelf(),t(DL).toService(zL),aA(t,IL)})),jL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}};NL=jL([qw()],NL);var VL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function UL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let GL=class extends NL{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(an(o)?o:1),y:(s-r.top)/(an(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return UL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return UL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:NM.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}};function YL(){Yk.rebind(MD).toService(RL)}GL=VL([qw(),WL("design:paramtypes",[])],GL);var $L=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KL=class extends NL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),YL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};KL=$L([qw(),XL("design:paramtypes",[])],KL);var qL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JL=class extends NL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Yk.rebind(MD).toService(RL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};JL=qL([qw(),ZL("design:paramtypes",[])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let eO=!1;try{eO=!!lynx.createCanvasNG}catch(t){}let iO=class extends NL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=eO?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,eO&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),YL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};iO=QL([qw(),tO("design:paramtypes",[])],iO);var nO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sO=class extends NL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};sO=nO([qw()],sO);var rO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let lO=class extends NL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return oO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{YL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};lO=rO([qw(),aO("design:paramtypes",[])],lO);var hO=new Gw((t=>{t(GL).toSelf().inSingletonScope(),t(hA).toService(GL),t(KL).toSelf().inSingletonScope(),t(hA).toService(KL),t(JL).toSelf().inSingletonScope(),t(hA).toService(JL),t(iO).toSelf().inSingletonScope(),t(hA).toService(iO),t(lO).toSelf().inSingletonScope(),t(hA).toService(lO),t(sO).toSelf().inSingletonScope(),t(hA).toService(sO),aA(t,hA)})),cO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uO=class{constructor(){this._uid=NM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};uO=cO([qw(),dO("design:paramtypes",[])],uO);var pO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fO=function(t,e){return function(i,n){e(i,n,t)}};let mO=class extends uO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:NM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new UD(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new UD({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};mO.env="browser",mO=pO([qw(),fO(0,Qw(cA)),gO("design:paramtypes",[Object])],mO);var yO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _O=class extends jD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};_O.env="feishu",_O=yO([qw()],_O);var vO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xO={WIDTH:500,HEIGHT:500,DPR:1};let SO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=xO.WIDTH,height:n=xO.HEIGHT,dpr:s=xO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new _O(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};SO.env="feishu",SO=vO([qw(),bO("design:paramtypes",[Object])],SO);var wO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kO=function(t,e){return function(i,n){e(i,n,t)}};let MO=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new SO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new SO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};MO.env="feishu",MO=wO([qw(),kO(0,Qw(cA)),AO("design:paramtypes",[Object])],MO);var CO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TO=class extends jD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(DI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(II(this,l,this.dpr)),r.setStrokeStyle(DI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=tR(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=tR(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};TO.env="taro",TO=CO([qw()],TO);var EO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const PO={WIDTH:500,HEIGHT:500,DPR:1};let BO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=PO.WIDTH,height:n=PO.HEIGHT,dpr:s=PO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new TO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};BO.env="taro",BO=EO([qw(),RO("design:paramtypes",[Object])],BO);var IO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LO=function(t,e){return function(i,n){e(i,n,t)}};let OO=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new BO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new BO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};OO.env="taro",OO=IO([qw(),LO(0,Qw(cA)),DO("design:paramtypes",[Object])],OO);var FO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zO=class extends jD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=II(this,l,this.dpr),r.strokeStyle=DI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};zO.env="lynx",zO=FO([qw()],zO);var HO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const NO={WIDTH:500,HEIGHT:500,DPR:1};let VO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=NO.WIDTH,height:n=NO.HEIGHT,dpr:s=NO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new zO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};VO.env="lynx",VO=HO([qw(),jO("design:paramtypes",[Object])],VO);var WO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GO=function(t,e){return function(i,n){e(i,n,t)}};let YO=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new VO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new VO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};YO.env="lynx",YO=WO([qw(),GO(0,Qw(cA)),UO("design:paramtypes",[Object])],YO);var $O=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KO=class extends jD{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ls(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};KO.env="node",KO=$O([qw(),XO("design:paramtypes",[Object,Number])],KO);var qO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const JO={WIDTH:500,HEIGHT:500,DPR:1};let QO=class{get id(){return this._id}get x(){return 0}get y(){return 0}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=JO.WIDTH,height:n=JO.HEIGHT,canvasControled:s=!0,dpr:r=JO.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new KO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&$i(this._nativeCanvas.release)&&this._nativeCanvas.release()}};QO.env="node",QO=qO([qw(),ZO("design:paramtypes",[Object])],QO);var tF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iF=function(t,e){return function(i,n){e(i,n,t)}};let nF=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new QO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new QO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};nF.env="node",nF=tF([qw(),iF(0,Qw(cA)),eF("design:paramtypes",[Object])],nF);var sF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rF=class extends jD{draw(){}createPattern(t,e){return null}};rF.env="wx",rF=sF([qw()],rF);var aF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const lF={WIDTH:500,HEIGHT:500,DPR:1};let hF=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=lF.WIDTH,height:n=lF.HEIGHT,dpr:s=lF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new rF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};hF.env="wx",hF=aF([qw(),oF("design:paramtypes",[Object])],hF);var cF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uF=function(t,e){return function(i,n){e(i,n,t)}};class pF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let gF=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new pF}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new hF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new hF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};gF.env="wx",gF=cF([qw(),uF(0,Qw(cA)),dF("design:paramtypes",[Object])],gF);var fF=new Gw((t=>{t(mO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(mO))).whenTargetNamed(mO.env),t(MO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(MO))).whenTargetNamed(MO.env),t(OO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(OO))).whenTargetNamed(OO.env),t(YO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(YO))).whenTargetNamed(YO.env),t(gF).toSelf(),t(gE).toDynamicValue((t=>t.container.get(gF))).whenTargetNamed(gF.env),t(nF).toSelf(),t(gE).toDynamicValue((t=>t.container.get(nF))).whenTargetNamed(nF.env)})),mF=new Gw((t=>{t(Gk).toSelf().inSingletonScope(),t(Uk).toService(Gk),aA(t,Uk)})),yF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vF=function(t,e){return function(i,n){e(i,n,t)}};let bF=class{constructor(t){this.global=t,this.offscreen=!1}init(t,e,i){if(this.layer=t,i.main)this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=qk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};bF=yF([qw(),vF(0,Qw(cA)),_F("design:paramtypes",[Object])],bF);var xF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wF=function(t,e){return function(i,n){e(i,n,t)}};let AF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=qk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};AF=xF([qw(),wF(0,Qw(cA)),SF("design:paramtypes",[Object])],AF);var kF=new Gw((t=>{t(bF).toSelf(),t(AF).toSelf(),t(sE).toService(bF)}));var MF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const CF=Symbol.for("DrawItemInterceptor"),TF=new Ts;let EF=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){TF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(TF),!0}};EF=MF([qw()],EF);let RF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=XP.allocate();QP(l,o);const h=r.modelMatrix;if(h){if(l){const t=XP.allocate();r.modelMatrix=tB(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===HT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=ds;for(;o<0;)o+=ds;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&XP.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};RF=MF([qw()],RF);var PF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IF=function(t,e){return function(i,n){e(i,n,t)}};let DF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Cs,this.backupDirtyBounds=new Cs}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=(h=l,c=n.dirtyBounds,d=!1,null===h?c:null===c?h:(Ks=h.x1,qs=h.x2,Zs=h.y1,Js=h.y2,Qs=c.x1,tr=c.x2,er=c.y1,ir=c.y2,d&&(Ks>qs&&([Ks,qs]=[qs,Ks]),Zs>Js&&([Zs,Js]=[Js,Zs]),Qs>tr&&([Qs,tr]=[tr,Qs]),er>ir&&([er,ir]=[ir,er])),Ks>=tr||qs<=Qs||Zs>=ir||Js<=er?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Ks,Qs),y1:Math.max(Zs,er),x2:Math.min(qs,tr),y2:Math.min(Js,ir)}));l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}var h,c,d;this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const u=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),u&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:kk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=vD(e,i,kk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(!ar(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):yD(t,kk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Yk.get(pI);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let OF=class{selector(t){return null}};OF=LF([qw()],OF);var FF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HF=function(t,e){return function(i,n){e(i,n,t)}};let jF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:v=l.path,lineWidth:b=l.lineWidth,visible:x=l.visible}=t.attribute,S=wE(u,m,p,g),w=kE(u,y,p,g),A=bE(h),k=xE(d,b);if(!t.valid||!x)return;if(!f){if(!(A||k||c))return;if(!(S||w||a||o||c))return}if(v&&v.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,v.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===_||en(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),jB(e,i,n,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const M={doFill:A,doStroke:k};this._groupRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o,M)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),M.doFill&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),M.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=jM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=XP.allocate(),i=XP.allocate();eB(i,t,a),tB(e,o||e,i),s.modelMatrix=e,XP.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&XP.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};jF=FF([qw(),HF(0,Qw(sA)),HF(0,Zw(OE)),zF("design:paramtypes",[Object])],jF);var NF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let VF=class extends CB{constructor(){super(...arguments),this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=jM(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,y=SE(u,p),_=AE(u,g),v=bE(c),b=xE(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};VF=NF([qw()],VF);var WF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UF=class extends DB{constructor(){super(...arguments),this.numberType=jT}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=jM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=SE(u,d),f=bE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};UF=WF([qw()],UF);var GF,YF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XF=function(t,e){return function(i,n){e(i,n,t)}},KF=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(GF||(GF={}));let qF=class extends DF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=GF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new lA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return KF(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:kk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return KF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return KF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>KF(this,void 0,void 0,(function*(){if(2!==t.count)yield _D(t,kk.zIndex,((i,n)=>{if(this.status===GF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return KF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return KF(this,void 0,void 0,(function*(){this.rendering&&(this.status=GF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=GF.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return KF(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>KF(this,void 0,void 0,(function*(){yield _D(t,kk.zIndex,(t=>KF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};YF([Qw(cA),$F("design:type",Object)],qF.prototype,"global",void 0),qF=YF([qw(),XF(0,tA(_I)),XF(1,Qw(PI)),XF(2,Qw(VF)),XF(3,Qw(UF)),XF(4,Qw(_E)),XF(5,Qw(sA)),XF(5,Zw(CF)),$F("design:paramtypes",[Array,Object,Object,Object,Object,Object])],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JF=class extends wB{constructor(){super(...arguments),this.type="rect3d",this.numberType=qT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=wE(g,f,u,p),x=kE(g,y,u,p),S=bE(c),w=xE(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=aT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=jM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};JF=ZF([qw()],JF);var QF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tz=class{constructor(){this.numberType=ZT}drawShape(t,e,i,n,s){const r=jM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&SE(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=jM(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),jB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=jM(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};tz=QF([qw()],tz);var ez=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iz=class{constructor(){this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=jM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};iz=ez([qw()],iz);var nz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sz=class extends wB{constructor(){super(...arguments),this.numberType=HT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=SE(p,g),v=AE(p,m),b=bE(c),x=xE(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=aT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},R={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=us(l-o),c=l>o;let d=!1;if(r=ds-os)e.moveTo(i+r*gs(o),n+r*ys(o),s),e.arc(i,n,r,o,l,!c,s),a>os&&(e.moveTo(i+a*gs(l),n+a*ys(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*gs(p),_=r*ys(p),v=a*gs(f),b=a*ys(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>os)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(R[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,ds,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=us(h-l),d=h>l;let u=!1;if(a<=os)e.moveTo(i,n,s);else if(c>=ds-os)e.moveTo(i+a*gs(l),n+a*ys(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*gs(h),n+a*ys(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*gs(c),f=a*ys(c),m=a*gs(p),y=a*ys(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(R[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=jM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};sz=nz([qw()],sz);var rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let az=class extends wB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=XT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=SE(u,p),x=AE(u,f),S=bE(c),w=xE(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=aT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=jM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};az=rz([qw()],az);var oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lz=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};lz=oz([qw()],lz);let hz=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};hz=oz([qw()],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};dz=cz([qw()],dz);let uz=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};uz=cz([qw()],uz);var pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gz=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};gz=pz([qw()],gz);let fz=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:RC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:RC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:RC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:RC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};fz=pz([qw()],fz);var mz=new Gw((t=>{t(DF).toSelf(),t(BI).toService(DF),t(qF).toSelf(),t(pI).toService(qF),t(OF).toSelf(),t(PI).toService(OF),t(ZE).toSelf().inSingletonScope(),t(yI).to(ZE),t(_I).to(ZE),t($I).toSelf().inSingletonScope(),t(XI).toSelf().inSingletonScope(),t(KI).toSelf().inSingletonScope(),t(LE).toService($I),t(LE).toService(XI),t(LE).toService(KI),aA(t,LE),t(UB).toSelf().inSingletonScope(),t(wI).to(UB),t(_I).to(UB),t(JF).toSelf().inSingletonScope(),t(AI).toService(JF),t(_I).toService(AI),t(eD).toSelf().inSingletonScope(),t(iD).toSelf().inSingletonScope(),t(nD).toSelf().inSingletonScope(),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(jE).toService(eD),t(jE).toService(iD),t(jE).toService(nD),t(jE).toService(sD),t(jE).toService(rD),aA(t,jE),t(JB).toSelf().inSingletonScope(),t(MI).to(JB),t(_I).to(JB),aA(t,VE),t(zB).toSelf().inSingletonScope(),t(xI).to(zB),t(_I).to(zB),t(dz).toSelf().inSingletonScope(),t(uz).toSelf().inSingletonScope(),t(zE).toService(dz),t(zE).toService(uz),aA(t,zE),t(XB).toSelf().inSingletonScope(),t(kI).to(XB),t(_I).to(XB),t(oD).toSelf().inSingletonScope(),t(lD).toSelf().inSingletonScope(),t(hD).toSelf().inSingletonScope(),t(NE).toService(oD),t(NE).toService(lD),t(NE).toService(hD),aA(t,NE),t($E).toSelf().inSingletonScope(),t(gI).to($E),t(_I).to($E),t(sz).toSelf().inSingletonScope(),t(fI).toService(sz),t(_I).toService(fI),t(WI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(GI).toSelf().inSingletonScope(),t(IE).toService(WI),t(IE).toService(UI),t(IE).toService(GI),aA(t,IE),t(CB).toSelf().inSingletonScope(),t(bI).to(CB),t(_I).to(CB),t(VF).toSelf().inSingletonScope(),t(UF).toSelf().inSingletonScope(),t(DB).toSelf().inSingletonScope(),t(mI).to(DB),t(_I).to(DB),t(gz).toSelf().inSingletonScope(),t(fz).toSelf().inSingletonScope(),t(DE).toService(gz),t(DE).toService(fz),aA(t,DE),t(jF).toSelf().inSingletonScope(),t(vI).to(jF),t(_I).to(jF),t(ZI).toSelf().inSingletonScope(),t(OE).toService(ZI),aA(t,OE),t(oI).toSelf().inSingletonScope(),t(SI).to(oI),t(_I).to(oI),t(lz).toSelf().inSingletonScope(),t(hz).toSelf().inSingletonScope(),t(HE).toService(lz),t(HE).toService(hz),aA(t,HE),t(iz).toSelf().inSingletonScope(),t(EI).toService(iz),t(_I).toService(EI),t(uI).toSelf().inSingletonScope(),t(RI).toService(uI),t(_I).toService(RI),t(QI).toSelf().inSingletonScope(),t(FE).toService(QI),aA(t,FE),t(tz).toSelf().inSingletonScope(),t(CI).toService(tz),t(_I).toService(CI),t(az).toSelf().inSingletonScope(),t(TI).toService(az),t(_I).toService(TI),t(jI).toSelf().inSingletonScope(),t(VE).toService(jI),t(IE).toService(jI),t(zE).toService(jI),t(NE).toService(jI),t(jE).toService(jI),t(FE).toService(jI),t(LE).toService(jI),t(DE).toService(jI),t(HE).toService(jI),aA(t,WE),aA(t,_I),t(EF).toSelf().inSingletonScope(),t(CF).toService(EF),t(RF).toSelf().inSingletonScope(),t(CF).toService(RF),aA(t,CF)}));var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};let bz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=II(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};bz=yz([qw(),vz(0,Qw(yI)),_z("design:paramtypes",[Object])],bz);var xz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wz=function(t,e){return function(i,n){e(i,n,t)}};const Az=new Ts;let kz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=KT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||rn(r,!0)&&0!==r||en(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=II(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;Az.setValue(i.x1,i.y1,i.x2,i.y2),Az.expand(-r/2),h=!Az.containsPoint(e)}}return n.highPerformanceRestore(),h}};kz=xz([qw(),wz(0,Qw(wI)),Sz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=II(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Ez=Mz([qw(),Tz(0,Qw(gI)),Cz("design:paramtypes",[Object])],Ez);var Rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bz=function(t,e){return function(i,n){e(i,n,t)}};let Iz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=jT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Iz=Rz([qw(),Bz(0,Qw(mI)),Pz("design:paramtypes",[Object])],Iz);var Dz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lz=class{constructor(){this.type="image",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Lz=Dz([qw()],Lz);var Oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fz=class extends wB{};Fz=Oz([qw()],Fz);var zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=jM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=II(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Nz=zz([qw(),jz(0,Qw(bI)),Hz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Gz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=YT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=II(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Gz=Vz([qw(),Uz(0,Qw(xI)),Wz("design:paramtypes",[Object])],Gz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xz=function(t,e){return function(i,n){e(i,n,t)}};let Kz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=JT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=jM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=II(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Kz=Yz([qw(),Xz(0,Qw(kI)),$z("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};let Qz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=QT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=jM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=iR(a,u,s),y=eR(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&XP.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Qz=qz([qw(),Jz(0,Qw(MI)),Zz("design:paramtypes",[Object])],Qz);var tH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iH=function(t,e){return function(i,n){e(i,n,t)}};let nH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=$T}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};nH=tH([qw(),iH(0,Qw(SI)),eH("design:paramtypes",[Object])],nH);var sH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aH=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let oH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ZT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};oH=sH([qw(),aH(0,Qw(CI)),rH("design:paramtypes",[Object])],oH);var lH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cH=function(t,e){return function(i,n){e(i,n,t)}};let dH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};dH=lH([qw(),cH(0,Qw(EI)),hH("design:paramtypes",[Object])],dH);var uH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gH=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let fH=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=qT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};fH=uH([qw(),gH(0,Qw(AI)),pH("design:paramtypes",[Object])],fH);var mH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_H=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let vH=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=XT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};vH=mH([qw(),_H(0,Qw(TI)),yH("design:paramtypes",[Object])],vH);var bH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SH=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let wH=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=HT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};wH=bH([qw(),SH(0,Qw(fI)),xH("design:paramtypes",[Object])],wH);var AH=new Gw(((t,e,i,n)=>{t(bz).toSelf().inSingletonScope(),t(XD).toService(bz),t(aL).toService(XD),t(kz).toSelf().inSingletonScope(),t(JD).toService(kz),t(aL).toService(JD),t(fH).toSelf().inSingletonScope(),t(QD).toService(fH),t(aL).toService(QD),t(Ez).toSelf().inSingletonScope(),t(GD).toService(Ez),t(aL).toService(GD),t(Iz).toSelf().inSingletonScope(),t($D).toService(Iz),t(aL).toService($D),t(Lz).toSelf().inSingletonScope(),t(KD).toService(Lz),t(aL).toService(KD),t(Nz).toSelf().inSingletonScope(),t(qD).toService(Nz),t(aL).toService(qD),t(Gz).toSelf().inSingletonScope(),t(ZD).toService(Gz),t(aL).toService(ZD),t(Kz).toSelf().inSingletonScope(),t(tL).toService(Kz),t(aL).toService(tL),t(Qz).toSelf().inSingletonScope(),t(eL).toService(Qz),t(aL).toService(eL),t(nH).toSelf().inSingletonScope(),t(iL).toService(nH),t(aL).toService(iL),t(vH).toSelf().inSingletonScope(),t(nL).toService(vH),t(aL).toService(nL),t(wH).toSelf().inSingletonScope(),t(YD).toService(wH),t(aL).toService(YD),t(oH).toSelf().inSingletonScope(),t(sL).toService(oH),t(aL).toService(sL),t(dH).toSelf().inSingletonScope(),t(rL).toService(dH),t(aL).toService(rL),aA(t,aL)})),kH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CH=function(t,e){return function(i,n){e(i,n,t)}};let TH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=YT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};TH=kH([qw(),CH(0,Qw(xI)),MH("design:paramtypes",[Object])],TH);var EH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PH=function(t,e){return function(i,n){e(i,n,t)}};let BH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};BH=EH([qw(),PH(0,Qw(yI)),RH("design:paramtypes",[Object])],BH);var IH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LH=function(t,e){return function(i,n){e(i,n,t)}};const OH=new Ts;let FH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=KT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||rn(r,!0)&&0!==r||en(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;OH.setValue(i.x1,i.y1,i.x2,i.y2),OH.expand(-r/2),h=!OH.containsPoint(e)}}return n.highPerformanceRestore(),h}};FH=IH([qw(),LH(0,Qw(wI)),DH("design:paramtypes",[Object])],FH);var zH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jH=function(t,e){return function(i,n){e(i,n,t)}};let NH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};NH=zH([qw(),jH(0,Qw(gI)),HH("design:paramtypes",[Object])],NH);var VH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let GH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=jT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};GH=VH([qw(),UH(0,Qw(mI)),WH("design:paramtypes",[Object])],GH);var YH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XH=function(t,e){return function(i,n){e(i,n,t)}};let KH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};KH=YH([qw(),XH(0,Qw(bI)),$H("design:paramtypes",[Object])],KH);var qH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JH=function(t,e){return function(i,n){e(i,n,t)}};let QH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=JT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};QH=qH([qw(),JH(0,Qw(kI)),ZH("design:paramtypes",[Object])],QH);var tj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ej=class{constructor(){this.type="text",this.numberType=QT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};ej=tj([qw()],ej);var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sj=function(t,e){return function(i,n){e(i,n,t)}};let rj=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=$T}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};rj=ij([qw(),sj(0,Qw(SI)),nj("design:paramtypes",[Object])],rj);var aj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lj=function(t,e){return function(i,n){e(i,n,t)}};let hj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};hj=aj([qw(),lj(0,Qw(EI)),oj("design:paramtypes",[Object])],hj);var cj=new Gw((t=>{t(BH).toSelf().inSingletonScope(),t(hL).toService(BH),t(yL).toService(hL),t(FH).toSelf().inSingletonScope(),t(uL).toService(FH),t(yL).toService(uL),t(NH).toSelf().inSingletonScope(),t(oL).toService(NH),t(yL).toService(oL),t(GH).toSelf().inSingletonScope(),t(lL).toService(GH),t(yL).toService(lL),t(KH).toSelf().inSingletonScope(),t(cL).toService(KH),t(yL).toService(cL),t(TH).toSelf().inSingletonScope(),t(dL).toService(TH),t(yL).toService(dL),t(QH).toSelf().inSingletonScope(),t(pL).toService(QH),t(yL).toService(pL),t(ej).toSelf().inSingletonScope(),t(gL).toService(ej),t(yL).toService(gL),t(rj).toSelf().inSingletonScope(),t(fL).toService(rj),t(yL).toService(fL),t(hj).toSelf().inSingletonScope(),t(mL).toService(hj),t(hj).toService(mL),aA(t,yL)}));var dj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new UD(t))).whenTargetNamed(UD.env),t(Kk).toDynamicValue((()=>(t,e)=>new jD(t,e))).whenTargetNamed(jD.env)})),uj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new BO(t))).whenTargetNamed(BO.env),t(Kk).toDynamicValue((()=>(t,e)=>new TO(t,e))).whenTargetNamed(TO.env)})),pj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new SO(t))).whenTargetNamed(SO.env),t(Kk).toDynamicValue((()=>(t,e)=>new _O(t,e))).whenTargetNamed(_O.env)})),gj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new VO(t))).whenTargetNamed(VO.env),t(Kk).toDynamicValue((()=>(t,e)=>new zO(t,e))).whenTargetNamed(zO.env)})),fj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new hF(t))).whenTargetNamed(hF.env),t(Kk).toDynamicValue((()=>(t,e)=>new rF(t,e))).whenTargetNamed(rF.env)})),mj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new QO(t))).whenTargetNamed(QO.env),t(Kk).toDynamicValue((()=>(t,e)=>new KO(t,e))).whenTargetNamed(KO.env)}));Yk.load(vE),Yk.load(BL),Yk.load(fD),Yk.load(PL),Yk.load(HL),function(t){t.load(hO),t.load(fF),t.load(mF),t.load(kF)}(Yk),function(t){t.load(mz)}(Yk),function(t){t.load(AH),t.load(cj)}(Yk),function(t){t.load(dj),t.load(pj),t.load(uj),t.load(gj),t.load(fj),t.load(mj)}(Yk);const yj=Yk.get(cA);$k.global=yj;const _j=Yk.get(yE);$k.graphicUtil=_j;const vj=Yk.get(mE);$k.transformUtil=vj;const bj=Yk.get(tE);$k.graphicService=bj,Yk.get(PD);const xj=Yk.get(_E);$k.layerService=xj;class Sj{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,$k.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),$k.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){$k.graphicService.hooks.onAttributeUpdate.taps=$k.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.onSetStage.taps=$k.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class wj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class Aj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,$k.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),$k.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){$k.graphicService.hooks.onAddIncremental.taps=$k.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.onClearIncremental.taps=$k.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,$k.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const kj=new Ts;class Mj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),$k.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(kj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(kj,t.parent&&t.parent.globalTransMatrix)))})),$k.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),$k.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){$k.graphicService.hooks.beforeUpdateAABBBounds.taps=$k.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.afterUpdateAABBBounds.taps=$k.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.onRemove.taps=$k.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Cj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===lC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=lC.INITIAL,$k.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),$k.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:oC},{mode:"timeout",cons:aC},{mode:"manual",cons:rC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==lC.INITIAL&&(this.status=lC.PAUSE,!0)}resume(){return this.status!==lC.INITIAL&&(this.status=lC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===lC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===lC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=lC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=lC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Cj.addTimeline(cC),Cj.setFPS(60);class Tj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=aT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=_s(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=ms(fs((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=tn(e)?aT.get(e).value:e;const r=this.colorRgb;return aT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const Ej="white";class Rj extends nE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Ej}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new zM,this.hooks={beforeRender:new lA(["stage"]),afterRender:new lA(["stage"])},this.global=Yk.get(cA),this.window=Yk.get(pE),this.renderService=Yk.get(pD),this.pickerService=Yk.get(MD),this.pluginService=Yk.get(DL),this.layerService=Yk.get(_E),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Ts,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Ej,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new tC({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Cj,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new Tj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new LD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new wj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new Sj))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Aj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Cs;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new Mj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.afterDraw((t=>{t.removeAllChild()}))}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new As(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Yk.get(pE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Pj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Pj||(Pj={}));const Bj="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Ij=Bj,Dj=14,Lj=18,Oj=4,Fj={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Dj}}},zj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Dj}}},Hj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Dj,offset:12,position:"outside"}}},jj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Dj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Dj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Dj,fill:"#707070",textBaseline:"middle"}}},Nj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Dj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Dj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Dj,fill:"#707070",textBaseline:"middle"}}},Vj="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",Wj={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:Vj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Vj,fill:"#ddd"}}},Uj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Dj}}},Gj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Yj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Dj,fontWeight:"normal",fillOpacity:1}}},$j={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Dj}}},Xj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Dj}}},Kj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Dj}}},qj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Dj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Dj}}},Zj={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Dj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Dj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Dj,textBaseline:"middle",textAlign:"center"}}},Jj="__VCHART",Qj=500,tN=500,eN=`${Jj}_LABEL_LIMIT`,iN=`${Jj}_LABEL_ALIGN`,nN=`${Jj}_LABEL_TEXT`,sN=`${Jj}_LABEL_VISIBLE`,rN=`${Jj}_LABEL_X`,aN=`${Jj}_LABEL_Y`,oN=`${Jj}_ARC_RATIO`,lN=`${Jj}_ARC_START_ANGLE`,hN=`${Jj}_ARC_END_ANGLE`,cN=`${Jj}_ARC_K`,dN=`${Jj}_ARC_LABEL_HOVER_AX`,uN=`${Jj}_ARC_LABEL_HOVER_AY`,pN=`${Jj}_ARC_LABEL_POINT_AX`,gN=`${Jj}_ARC_LABEL_POINT_AY`,fN=`${Jj}_ARC_LABEL_POINT_BX`,mN=`${Jj}_ARC_LABEL_POINT_BY`,yN=`${Jj}_ARC_LABEL_POINT_CX`,_N=`${Jj}_ARC_LABEL_POINT_CY`,vN=`${Jj}_ARC_LABEL_SELECTED_AX`,bN=`${Jj}_ARC_LABEL_SELECTED_AY`,xN=`${Jj}_ARC_MIDDLE_ANGLE`,SN=`${Jj}_ARC_QUADRANT`,wN=`${Jj}_ARC_RADIAN`,AN=-Math.PI/2,kN=3*Math.PI/2,MN=-90,CN=270,TN=.6,EN={},RN=[],PN=(t,e,i)=>{EN[t]=Object.assign(e,{type:t}),i||RN.push(t)},BN=()=>{RN.slice().forEach((t=>{(t=>{delete EN[t];const e=RN.indexOf(t);e>=0&&RN.splice(e,1)})(t)}))};function IN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:tn(t)?t:Xi(s=t)?null:s.fname})):null}function DN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function LN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const ON=":vGrammar_identifier:";function FN(t,e){return Cn(t).reduce(((t,i)=>{const n=tn(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function zN(t,e){if(Xi(t))return[];if(!$i(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(tn(i))return Cn(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!$i(t)&&!!(null==t?void 0:t.callback)}(t))return FN(t.dependency,e);var i;return[]}function HN(t){return $i(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function jN(t,e,i,n){if(Xi(t))return t;if($i(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return tn(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function NN(t,e){return VN(t)?t.output():e[t]}const VN=t=>t&&!Xi(t.grammarType),WN=t=>$i(t)?t:e=>e[t],UN=t=>tn(t)&&Ws.parseColorString(t)?t:null;function GN(t){return!!(null==t?void 0:t.scale)}function YN(t){return!!(null==t?void 0:t.field)}function $N(t,e){if(!t)return[];let i=[];return t.scale&&(i=VN(t.scale)?[t.scale]:Cn(e.getScaleById(t.scale))),i.concat(zN(t,e))}class XN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return tn(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Cn(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const KN={},qN=t=>KN[t],ZN=(t,e,i,n,s)=>(KN[t]=new XN(e,i,n,s),KN[t]);function JN(t){return null===t?0:t}function QN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const tV=["fillOpacity","x","y","dx","dy"],eV=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=JN(i.x),["x"]):"y"===e?(t.y=JN(i.y),["y"]):"dx"===e?(t.dx=JN(i.dx),["dx"]):"dy"===e?(t.dy=JN(i.dy),["dy"]):[]};var iV,nV,sV,rV,aV,oV,lV,hV,cV,dV,uV,pV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(iV||(iV={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(nV||(nV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(sV||(sV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(rV||(rV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(aV||(aV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(oV||(oV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(lV||(lV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(hV||(hV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(cV||(cV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(dV||(dV={})),function(t){t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd"}(uV||(uV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(pV||(pV={}));const gV={[nV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;an(e.width)||!an(e.x1)&&an(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):an(e.x1)||!an(e.width)&&an(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),an(e.height)||!an(e.y1)&&an(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):an(e.y1)||!an(e.height)&&an(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;an(e.width)||!an(e.x1)&&an(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):an(e.x1)||!an(e.width)&&an(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),an(e.height)||!an(e.y1)&&an(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):an(e.y1)||!an(e.height)&&an(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),an(e.length)||!an(e.z1)&&an(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):an(e.z1)||!an(e.length)&&an(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[nV.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[nV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return an(e)&&an(i)&&an(n)&&an(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[nV.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const fV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=tn(t)?gV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(tV.includes(r)?eV(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{tV.includes(t)?eV(s,t,e):s[t]=e[t]}));return s},mV=(t,e,i)=>!(!Xi(t)||!Xi(e))||!Xi(t)&&!Xi(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(tn(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function yV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case nV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case nV.group:case nV.rect:case nV.image:return["width","height","y1"].includes(e);case nV.path:case nV.shape:return["path","customPath"].includes(e);case nV.line:return"defined"===e;case nV.area:return["x1","y1","defined"].includes(e);case nV.rule:return["x1","y1"].includes(e);case nV.symbol:return"size"===e;case nV.polygon:return"points"===e;case nV.text:return"text"===e}return!1}function _V(t,e,i,n,s){i&&(HN(i)?e.forEach((e=>{const s=jN(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=s&&!yV(t.mark.markType,r)?[e[0]]:e;if(GN(l)){const t=NN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!Xi(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=tn(null==l?void 0:l.field),c=s?dl(l.field):null;let d=s?null:Xi(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((n=>{var a;s&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(n.datum))),n.nextAttrs[r]=rn(d)||rn(i)?d+e+i:d}))}else if(YN(l)){const t=dl(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=jN(l,n,e.datum,t)}))})))}function vV(t,e,i,n){if(!t)return null;if(HN(t))return jN(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(GN(h)){const t=NN(h.scale,n),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!Xi(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=tn(null==h?void 0:h.field),u=d?dl(h.field):null,p=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,u(e)):Xi(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);s[r]=rn(p)||rn(c)?p+i+c:p}else if(YN(h)){const t=dl(h.field);s[r]=t(e)}else s[r]=jN(h,n,e,i)})),s}function bV(t){if(t)return t.type===jl.Band?t.bandwidth():t.type===jl.Point?t.step():void 0}const xV={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=$i(i)?i:ml(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!Xi(s)){if(Xi(t))return;t[s]=e}return e})),e;const r=n(e,i);return Xi(s)||Xi(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=ll();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=dl(a),h=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),c=Xi(t.default)?null:t.default,d=s.map((t=>dl(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),Xi(n)&&(n=o);const t=o.map((t=>dl(t)));return e.map((e=>d.reduce(((i,s,r)=>{const a=h[s(e)],l=o.length;return(Xi(a)?t.map((t=>c)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>d.reduce(((e,i,s)=>{const r=h[i(t)];return e[n[s]]=Xi(r)?c:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=IN(i,t.as||[]),s=i.map((t=>tn(t)?dl(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Bn(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],b=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),b=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),x=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),S=an(x*_)?x/_:null,w=an(_*_)?_/b:null;return d&&(y[d]=b),p&&(y[p]=x),r&&(y[r]=S),a&&(y[a]=0===i?1:w),o&&(y[o]=!0===g?S:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:x/v[1]),c&&(y[c]=0===i?1:b/v[1]),u&&(y[u]=_),y}));return b},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=DN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=LN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return LN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;Xi(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=Xi(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=Xi(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{Xi(n[ON])&&(n[ON]=0);let s=n[ON];const r=t.as;return e.forEach((t=>{t&&Xi(t[r])&&(s+=1,t[r]=s)})),n[ON]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=bV(a.y),l="y"===t.dodgeChannel||Xi(t.dodgeChannel)&&o>0?"y":"x",h="y"===l?o:bV(a.x);if(h>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!Xi(t.dodgeBy)){const e=nl(Cn(t.dodgeBy));o=t=>e(t.getDatum())}const c=[];e.forEach((t=>{const e=o(t);c.includes(e)||c.push(e)}));const d=c.length;if(d<1)return e;const u=vl(a,h);let p=u>=h?h:h-u;const g=vl(i,p);let f=(p-Math.max(d-1,0)*g)/d;f>t.maxWidth?(p-=(f-t.maxWidth)*d,f=t.maxWidth):f{m[t]=-p/2+e*(f+g)}));const y=r.markType;"rect"===y||"interval"===y?e.forEach((t=>{const e=o(t),i=m[e],n=t.getItemAttribute();if("x"===l){const e={x:(Xi(n.width)&&!Xi(n.x1)?Math.min(n.x,n.x1):n.x)+(Xi(n.width)?Xi(n.x1)?h:Math.abs(n.x1-n.x):n.width)/2+i};Xi(n.width)?e.x1=e.x+f:e.width=f,t.setItemAttributes(e)}else if("y"===l){const e={y:(Xi(n.height)&&!Xi(n.y1)?Math.min(n.y,n.y1):n.y)+(Xi(n.height)?Xi(n.y1)?h:Math.abs(n.y1-n.y):n.height)/2+i};Xi(n.height)?e.y1=e.y+f:e.height=f,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=m[e];if("x"===l){const e=t.getItemAttribute("x")+h/2;t.setItemAttributes({x:e+i+f/2})}else if("y"===l){const e=t.getItemAttribute("y")+h/2;t.setItemAttributes({y:e+i+f/2})}}))}return e},markPhase:"afterEncodeItems"}},SV="__vgrammar_scene_item__",wV=[nV.line,nV.area],AV=[nV.arc3d,nV.rect3d,nV.pyramid3d],kV="key",MV=[{}],CV=["key"],TV="VGRAMMAR_IMMEDIATE_ANIMATION",EV=0,RV=1e3,PV=0,BV=!1,IV=!1,DV="quintInOut",LV={stopWhenStateChange:!1,immediatelyApply:!0},OV={},FV=t=>OV[t],zV=(t,e)=>{OV[t]={creator:e}};class HV extends nE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new mk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Ok.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new mk;let a,o;r.clear();const l=rn(s)?s:fs(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(uV.BEFORE_CREATE_VRENDER_MARK),e===nV.largeRects)return new HV(i);if(e===nV.largeSymbols)return new jV(i);const n=NV[e]?NV[e](i):FV(e)?FV(e).creator(i):null;return t.emit(uV.AFTER_CREATE_VRENDER_MARK),n}function WV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(uV.BEFORE_CREATE_VRENDER_MARK);const n=new eP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=NV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(uV.AFTER_CREATE_VRENDER_MARK),n}const UV=t=>{t&&(t[SV]=null,t.release(),t.parent&&t.parent.removeChild(t))};class GV{constructor(t){this.data=null,this.states=[],this.diffState=iV.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if($i(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));_V(this,o,a,this.mark.parameters());const l=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=l):this.graphicItem.states={[t]:l},l},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[SV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?fV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;Xi(t.clip)||this.graphicItem.setAttribute("clip",t.clip),Xi(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),Xi(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===iV.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(uV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=WN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(uV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=Cn(jN(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===iV.unChange&&(this.diffState=iV.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==iV.enter&&this.diffState!==iV.update||!this.states.length||this.useStates(this.states),this.mark.markType===nV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new mk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===iV.enter?(r&&_V(this,t,r,i,o),s&&_V(this,t,s,i,o)):this.diffState===iV.update?(n&&r&&_V(this,t,r,i,o),s&&_V(this,t,s,i,o)):this.diffState===iV.exit&&a&&_V(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=Yi(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=Cn(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&tn(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=Cn(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(uV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=Yi(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(uV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)_l(n,i,t)&&fn(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=null==l?void 0:l.nextAttrs;if(t&&t.length&&Xi(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||QN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[nV.line,nV.area,nV.largeRects,nV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),c=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),d=t.map((t=>t.nextAttrs)),u=this.mark.isProgressive();if(h=Object.assign({},h),delete h.x,delete h.y,e===nV.line||e===nV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>QN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=JN(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=JN(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=JN(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=JN(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===nV.area);if(c&&!u){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>mV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=fV(nV.line,t.attrs,i);return n.points=e.slice(t.startIndex,Xi(t.endIndex)?e.length:t.endIndex),n})):null}(d,t,this);e?Object.assign(h,{segments:e,points:null}):Object.assign(h,{points:t,segments:null})}else u?Object.assign(h,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(h,{points:s,segments:null})}else e===nV.largeRects?h.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=JN(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=JN(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=JN(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=JN(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===nV.largeSymbols&&(h.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=JN(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=JN(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return h}applyGraphicAttributes(t){if(!un(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!Xi(e=pn(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return pn(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!fn(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!fn(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(UV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(UV(this.graphicItem),this.graphicItem[SV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?Xi(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):Xi(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?en(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const YV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(an(e.center.x)&&(s.x=e.center.x),an(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},$V=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),XV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const KV=["visible","path","text","lineWidth","textBaseline","textAlign"],qV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=an(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=an(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=an(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=an(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=Un(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:an(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=Un(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:an(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),h=t.getGraphicItem().attribute.x,c=t.getGraphicItem().attribute.y,d=t.getGraphicItem().attribute.width,u=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:h+d/2,x1:h+d/2,width:Xi(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:c+u/2,y1:c+u/2,height:Xi(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:h+d/2,x1:h+d/2,y:c+u/2,y1:c+u/2,width:Xi(o)?void 0:0,height:Xi(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:Xi(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:Xi(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:Xi(n)?void 0:0,height:Xi(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:Xi(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:Xi(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:Xi(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:Xi(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:Xi(n)?void 0:0}}:{to:{x:s,x1:s,width:Xi(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:Xi(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:Xi(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:Xi(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:Xi(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:Xi(n)?void 0:0}}:{to:{y:s,y1:s,height:Xi(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=rn(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=rn(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:YV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:YV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:$V(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:$V(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:XV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:XV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return KV.forEach((t=>{delete n[t],delete s[t]})),Cn(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{_l(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},ZV=Object.assign({},qV),JV=t=>ZV[t],QV=(t,e)=>{ZV[t]=e},tW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!an(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return an(d)&&(m.from.min=l,m.to.min=d),an(u)&&(m.from.max=l,m.to.max=u),an(p)&&(m.from.q1=l,m.to.q1=p),an(g)&&(m.from.q3=l,m.to.q3=g),an(f)&&(m.from.median=l,m.to.median=f),m},eW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!an(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return an(d)&&(m.to.min=l,m.from.min=d),an(u)&&(m.to.max=l,m.from.max=u),an(p)&&(m.to.q1=l,m.from.q1=p),an(g)&&(m.to.q3=l,m.from.q3=g),an(f)&&(m.to.median=l,m.from.median=g),m},iW=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(an(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return an(f)?f:an(_)&&an(v)?(_+v)/2:an(m)&&an(y)?(m+y)/2:an(y)?y:an(m)?m:NaN},nW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(an(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),an(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(an(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),an(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const sW=(t,e,i)=>{var n,s,r,a;if(an(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return an(o)?o:an(c)&&an(d)?(c+d)/2:an(l)&&an(h)?(l+h)/2:an(h)?h:an(l)?l:NaN},rW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(an(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),an(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(an(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),an(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const aW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},oW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},lW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?oW:aW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},hW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{Xi(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},cW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{Xi(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},dW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{Xi(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function uW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(kV,i?t.slice().sort(i):t.slice()),{keys:CV,data:n};const s=WN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class pW{constructor(t,e,i){this.prevData=uW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const gW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{Xi(i[t])&&delete i[t]}));const n=QN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{Xi(i[t])&&delete i[t]}));const n=QN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const fW=(t,e,i,n,s)=>$i(i)?i(t.getDatum(),t,s):i;class mW extends dC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class yW extends dC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{Xi(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:EA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:EA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}pC.mode|=PA.SET_ATTR_IMMEDIATELY;let _W=0;const vW=t=>!Xi(t)&&t.prototype instanceof dC;class bW{constructor(t,e,i){this.id=_W++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),an(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=$i(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!JV(e.type))return null;const r=JV(e.type)(t,s,i);return gW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return en(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):qi(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!Xi(null===(r=s[i])||void 0===r?void 0:r.from),l=!Xi(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?fW(t,0,s[i].from,0,n):void 0,e.to[i]=l?fW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),gW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),l=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const h=vW(o);return Xi(o)||vW(o)?h?new o(a.from,a.to,r,t.easing,l):a.to?new yW(a.from,a.to,r,t.easing):void 0:new mW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!Xi(t)));1===e.length?t.play(e[0]):t.play(new HC(r,e))}}}function xW(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(SW(i,t[i]))})),e}function SW(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Cn(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,h,c,d;if(Xi(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:EV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:IV,loop:null!==(n=l.loop)&&void 0!==n?n:BV,controlOptions:xn({},LV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:RV,delay:null!==(a=l.delay)&&void 0!==a?a:PV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:DV,customParameters:l.customParameters,options:l.options}]}]}}const u=Cn(t.timeSlices).filter((t=>t.effects&&Cn(t.effects).filter((t=>t.channel||t.type)).length));if(u.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:EV,totalTime:t.totalTime,oneByOne:null!==(h=t.oneByOne)&&void 0!==h?h:IV,loop:null!==(c=t.loop)&&void 0!==c?c:BV,controlOptions:xn({},LV,null!==(d=t.controlOptions)&&void 0!==d?d:{}),timeSlices:u.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:PV,effects:Cn(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:DV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function wW(t,e,i){return $i(t)?t.call(null,e.getDatum(),e,i):t}class AW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!Xi(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class kW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=xW(null!=e?e:{})}updateConfig(t){this.configs=xW(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==iV.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new AW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=SW(TV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new AW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return Xi(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=Cn(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Cn(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Cn(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===iV.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(Xi(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},o),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new bW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===iV.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(uV.ANIMATION_START,d),this.mark.emit(uV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=jN(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=wW(t.startTime,e,s),o=wW(t.totalTime,e,s),l=wW(t.oneByOne,e,s),h=wW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=wW(t.delay,e,s),l=null!==(i=wW(t.duration,e,s))&&void 0!==i?i:o/n,h=Cn(t.effects).map((t=>Object.assign({},t,{customParameters:wW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=rn(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:rn(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===iV.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===iV.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===TV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===iV.exit&&0===a[iV.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(uV.ANIMATION_END,h),this.mark.emit(uV.ELEMENT_ANIMATION_END,h,i)}}const MW=(t,e)=>VN(t)?t.output():t&&qi(t)?$i(t.callback)?i=>t.callback(i,e):$i(t.value)?t.value(e):t:t,CW=(t,e)=>t?qi(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=MW(s,e),i}),{}):t.map((t=>MW(t,e))):t;var TW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let EW=-1;class RW extends Ui{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++EW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Cn(this.spec.dependency).map((t=>tn(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Cn(t).map((t=>tn(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return Cn(t).filter((t=>!Xi(t))).forEach((i=>{var n;Xi(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Cn(t).filter((t=>!Xi(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return Xi(this.spec[e])||this.detach(zN(this.spec[e],this.view)),this.spec[e]=t,this.attach(zN(t,this.view)),this.commit(),this}}const PW=(t,e,i)=>{var n,s;if("callback"===t&&$i(e))return{references:[],value:{callback:e,dependency:[]}};if(!Xi(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!Xi(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!Xi(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=zN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},BW=(t,e)=>{const i=(n=t.type,EN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(FN(a,e))));const o=((t,e,i)=>{if(Xi(e))return{value:e};if(en(e)){const n=e.map((e=>PW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return PW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},IW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=BW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class DW extends GV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if($i(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return _V(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[SV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?fV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(uV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=Yi(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(uV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===iV.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==iV.enter&&this.diffState!==iV.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!Xi(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===iV.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=fV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{fn(this.items[0].nextAttrs,e)||fn(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=gV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{fn(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===nV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return wV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&fn(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),fn(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),fn(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)_l(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[SV]=null})),this.glyphGraphicItems=null),super.release()}}const LW=t=>t.markType===nV.glyph?new DW(t):new GV(t);function OW(t){return Xi(t.offsetX)?Xi(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function FW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return an(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),an(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&an(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&an(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const zW="window",HW="view",jW={trap:!1},NW="default",VW="width",WW="height",UW="viewWidth",GW="viewHeight",YW="padding",$W="viewBox",XW="autoFit";function KW(t,e,i,n,s){if(s===zW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{FW(t,OW(t),!1)}))}));const e=OW(t);FW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var qW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class ZW extends RW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new kW(this,{}),this.differ=new pW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=tn(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=tn(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!Xi(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===iV.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===dV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:MV,e);let n=i;i.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(uV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(uV.AFTER_MARK_JOIN),this.emit(uV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(uV.AFTER_MARK_STATE),this.emit(uV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(uV.AFTER_MARK_ENCODE)}return this.emit(uV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(uV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>Xi(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return qW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,Xi(t)||(tn(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return tn(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];HN(i)?this.detach($N(i,this.view)):tn(e)?this.detach($N(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach($N(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return tn(e)?(this.spec.encode[t][e]=i,this.attach($N(i,this.view))):HN(e)?(this.spec.encode[t]=e,this.attach($N(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach($N(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=IW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=IW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{Xi(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{Xi(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return wV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!Xi(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===iV.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];HN(s)||Object.keys(s).forEach((t=>{GN(s[t])&&(e[t]=NN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[SV];if((null==n?void 0:n.mark)===this){const i=KW(this.view,t,n,e,HW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new kW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=NN(this.spec.group,e);this.group=t,t&&(this.emit(uV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(uV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==nV.group){if(!this.graphicItem){const t=VV(this,nV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||AV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==nV.group?(Xi(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),Xi(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=WN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>kV),a=WN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>kV),o=this.spec.sort,l=this.spec.groupSort,h=this.isCollectionMark(),c=new Set(this.elements.filter((t=>t.diffState===iV.enter))),d=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(Xi(e))s=this.elementMap.get(n),s&&(s.diffState=iV.exit);else if(Xi(i)){s=this.elementMap.has(n)?this.elementMap.get(n):LW(this),s.diffState===iV.exit&&(s.diffState=iV.enter,this.animate.getElementAnimators(s,iV.exit).forEach((t=>t.stop("start")))),s.diffState=iV.enter;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),d.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=iV.update;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),d.push(s)}c.delete(s)}));const u=null!=t?t:MV;this.differ.setCurrentData(uW(u,h?a:t=>`${a(t)}-${r(t)}`,h?l:void 0)),this.differ.doDiff(),c.forEach((t=>{this.elementMap.delete(h?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=d,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(uV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(uV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:VV(this,this.markType,t);if(this.emit(uV.BEFORE_ADD_VRENDER_MARK),this.markType===nV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(uV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==nV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=uW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=WN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>kV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=LW(this);e.diffState=iV.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=LW(this);i.diffState=iV.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(HN(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===nV.glyph&&qN(i)){const t=qN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>yV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{yV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(uV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(uV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(yV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(uV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(uV.AFTER_MARK_JOIN),this.emit(uV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(uV.AFTER_MARK_STATE),this.emit(uV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(uV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(uV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(uV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||CV).forEach((t=>{const e=VV(this,nV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(uV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(uV.AFTER_MARK_STATE),this.emit(uV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(uV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==iV.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return gV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=iV.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&UV(this.graphicItem),this.detachAll(),super.release()}}class JW extends ZW{constructor(t,e,i){super(t,nV.component,i),this._componentDatum={[kV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:FV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,kV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[kV]+=1}evaluateJoin(t){return this.spec.key=kV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=tn(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=tn(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const QW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class tU extends nE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){Ji(this.attribute[t])?xn(this.attribute[t],e):this.attribute[t]=e,QW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>QW.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){Xi(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=Kn(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=Kn(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===yj.env?(yj.addEventListener("pointermove",this._onSliderPointerMove),yj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===yj.env?(yj.removeEventListener("pointermove",this._onSliderPointerMove),yj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=qn(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(qn(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Tr(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=Tr(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=qn(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?qn([a+i*s,a+n*s],a,s-l):qn([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new XM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function iU(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&iU(t,e)}))}eU.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const nU=t=>!Xi(t)&&!1!==t.visible,sU=["#ffffff","#000000"];function rU(t,e,i,n,s){const r=hU(t),a=hU(e);return aU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...sU);for(const s of r)if(t!==s&&aU(s,e,i,n))return s}(r,a,i,n,s)}function aU(t,e,i,n){return n?oU(t,e)>n:"largeText"===i?oU(t,e)>3:oU(t,e)>4.5}function oU(t,e){const i=lU(t),n=lU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function lU(t){const e=Gs(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function hU(t){if(null==t?void 0:t.includes("#"))return t;const e=new Ws(t),{r:i,g:n,b:s}=e.color;return"#"+Ys(i,n,s)}function cU(t,e){return[t[0]*e,t[1]*e]}function dU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const uU=-.5*Math.PI,pU=1.5*Math.PI,gU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var fU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(fU||(fU={}));const mU={[fU.selectedReverse]:{},[fU.selected]:{},[fU.hover]:{},[fU.hoverReverse]:{}},yU=(t,e,i)=>new wr(Object.assign({defaultFontParams:{fontFamily:gU,fontSize:11},getTextBounds:i?void 0:xB,specialCharSet:"-/: .,@%'\"~"+wr.ALPHABET_CHAR_SET+wr.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function _U(t,e){var i,n;if(!t)return{width:0,height:0};const s=xB({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var vU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);so&&(g=o,x.setAttribute("maxLineWidth",o-d[1]-d[2])));let E=0,R=0;"center"===C?(E-=g/2,p&&p.setAttribute("x",(p.attribute.x||0)-w/2),u.setAttribute("x",-y/2)):"right"===C||"end"===C?(E-=g,p&&p.setAttribute("x",(p.attribute.x||0)-w),u.setAttribute("x",-d[1]-y)):"left"!==C&&"start"!==C||u.setAttribute("x",d[3]),"middle"===T?(R-=f/2,p&&p.setAttribute("y",0)):"bottom"===T?(R-=f,p&&p.setAttribute("y",-A/2),u.setAttribute("y",-d[2])):"top"===T&&(u.setAttribute("y",d[0]),p&&p.setAttribute("y",A/2));const{visible:P}=s,B=vU(s,["visible"]);if(h&&Yi(P)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},B),{visible:P&&!!e,x:E,y:R,width:g,height:f}),"rect");un(null==c?void 0:c.panel)||(t.states=c.panel)}}}bU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};class xU extends tU{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class SU extends xU{constructor(t){super(xn({},SU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}SU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class wU extends xU{constructor(t){super(xn({},wU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}wU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class AU extends xU{constructor(t){super(xn({},AU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=ks.distancePP(t,e);this.setAttribute("radius",i)}}AU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class kU extends xU{constructor(t){super(xn({},kU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=uU,endAngle:n=pU}=this.attribute,s=n-i,r=Rs(Ds(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}kU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class MU extends xU{constructor(t){super(xn({},MU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=Is(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=ks.distancePP(t,e);this.setAttribute("radius",i)}}MU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const CU=new Uint32Array(33),TU=new Uint32Array(33);TU[0]=0,CU[0]=~TU[0];for(let t=1;t<=32;++t)TU[t]=TU[t-1]<<1|1,CU[t]=~TU[t];function EU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&CU[31&n]&TU[1+(31&s)])return!0}else{if(i[r]&CU[31&n])return!0;if(i[a]&TU[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,CU[31&i]&TU[1+(31&s)]);else for(n(r,CU[31&i]),n(a,TU[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,TU[31&i]|CU[1+(31&n)]);else for(s(r,TU[31&i]),s(a,CU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function RU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=Kn(i,0,t.width),o=Kn(n,0,t.width),l=Kn(s,0,t.height),h=Kn(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function PU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=RU(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function BU(t,e){return!(!t||!e)&&e.encloses(t)}function IU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return IU(t,e,s,l,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?$i(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return IU(t,e,s,r,null===(l=n.overlap)||void 0===l?void 0:l.clampForce)}if("moveX"===i.type){const r=(i.offset?$i(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return IU(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}return!1}const LU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],OU=["top","inside-top","inside"];const FU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function zU(t,e){var i,n;return null!==(n=null===(i=FU[e])||void 0===i?void 0:i.call(FU,t))&&void 0!==n?n:{from:{},to:{}}}const HU="same-time",jU=300,NU="linear";class VU extends tU{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||un(e.states)||(e.addState(fU.hover,!0),iU(this,(t=>{t===e||un(t.states)||t.addState(fU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(iU(this,(t=>{un(t.states)||(t.removeState(fU.hoverReverse),t.removeState(fU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void iU(this,(t=>{un(t.states)||(t.removeState(fU.selectedReverse),t.removeState(fU.selected))}));un(e.states)||(e.addState(fU.selected,!0),iU(this,(t=>{t===e||un(t.states)||t.addState(fU.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!un(e)&&(t.states=e)}_createLabelText(t){const e=gB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if($i(s)&&(s=s({})),!s||0===s.length)return[];let r=[];$i(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],l=this.getBaseMarkGroup(),h=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==l?void 0:l.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==l?void 0:l.AABBBounds.height())&&void 0!==s?s:0};if(0===h.width||0===h.height)return t;const{avoidBaseMark:c,strategy:d=[],hideOnHit:u=!0,clampForce:p=!0}=e,g=this._bmpTool||EU(h.width,h.height),f=this._bitmap||g.bitmap(),m=d.some((t=>"bound"===t.type));c&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&f.setRange(RU(g,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:HU,h=null!==(n=a.duration)&&void 0!==n?n:jU,c=null!==(s=a.easing)&&void 0!==s?s:NU,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=zU(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&an(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new PC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(zU(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==EA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===EA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=rU(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=rU(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=rU(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class WU extends VU{constructor(t){super(xn({},WU.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}WU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class UU extends VU{constructor(t){super(xn({},UU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}UU.tag="rect-label",UU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const GU={rect:UU,symbol:WU};class YU extends tU{constructor(t){super(xn({},YU.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!an(n*i))return;this._componentMap||(this._componentMap=new Map);const s=EU(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function $U(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function XU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=ks.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function KU(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=$U(t,!!s),o=$U(r,!!s);const h=ks.distancePP(n,l),c=ks.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=XU(e,t,!1,!!s),o=XU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=$U(t,!!s),o=$U(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}YU.defaultAttributes={pickable:!1};class qU extends tU{constructor(t){super(xn({},qU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!un(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let l="";if("line"===t||"polygon"===t)l=$U(o,!!n);else if("circle"===t){const{center:t}=this.attribute;l=XU(t,o,!1,!!n)}const h=dB(Object.assign({path:l,z:r},$i(i)?xn({},qU.defaultAttributes.style,i(e,s)):i));h.name=`${this.name}-line`,h.id=this._getNodeId(`path-${a}`),this.add(h)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const l=a[1].x-a[0].x,h=a[1].y-a[0].y,c=Math.sqrt(l*l+h*h),d=r/c;o.push({x:a[0].x+l*d,y:a[0].y+h*d});const u=$U(o,!!n),p=us(o[0].x-o[1].x),g=us(o[0].y-o[1].y),f=dB(Object.assign({path:u,z:0,alpha:p>g?(a[1].x-a[0].x>0?-1:1)*ls/2:0,beta:pg?[o[0].x,0]:[0,o[0].y]},$i(i)?xn({},qU.defaultAttributes.style,i(t,e)):i));f.name=`${this.name}-line`,f.id=this._getNodeId(`path-${s}`),this.add(f)})),e.length>1&&s)){const t=en(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0:i.size)||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};l=[...l.slice(0,l.length-1),n]}const h=cB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),un(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=fB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),un(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var JU,QU;ZU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(JU||(JU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(QU||(QU={}));const tG={[QU.selectedReverse]:{},[QU.selected]:{},[QU.hover]:{},[QU.hoverReverse]:{}},eG={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var iG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!un(e.states)&&(e.addState(fU.hover,!0),iU(this.axisContainer,(t=>{t!==e&&t.name&&!un(t.states)&&t.addState(fU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(iU(this.axisContainer,(t=>{t.name&&!un(t.states)&&(t.removeState(fU.hoverReverse),t.removeState(fU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(fU.selected))return this._lastSelect=null,void iU(this.axisContainer,(t=>{t.name&&!un(t.states)&&(t.removeState(fU.selectedReverse),t.removeState(fU.selected))}));e.name&&!un(e.states)&&(e.addState(fU.selected,!0),iU(this.axisContainer,(t=>{t!==e&&t.name&&!un(t.states)&&t.addState(fU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=yn(this.attribute);xn(this.attribute,t);const i=hB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=hB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,grid:r,items:a,panel:o}=this.attribute,l=hB({x:0,y:0,zIndex:1});if(l.name=JU.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=hB({x:0,y:0,pickable:!1});t.name=JU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=uB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=JU.background,e.id=this._getNodeId("background"),un(o.state)||(e.states=xn({},mU,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){var e;const i=this.getTickLineItems(),n=hB({x:0,y:0,pickable:!1});n.name=JU.tickContainer,n.id=this._getNodeId("tick-container"),t.add(n);const s=un(null===(e=this.attribute.tick)||void 0===e?void 0:e.state)?null:xn({},mU,this.attribute.tick.state);i.forEach(((t,e)=>{const r=cB(Object.assign({},this._getTickLineAttribute("tick",t,e,i)));r.name=JU.tick,r.id=this._getNodeId(t.id),r.states=s,n.add(r)})),this.tickLineItems=i;const{subTick:r}=this.attribute;if(null==r?void 0:r.visible){const t=this.getSubTickLineItems();if(t.length){const e=un(r.state)?null:xn({},mU,r.state);t.forEach(((t,s)=>{const r=cB(Object.assign({},this._getTickLineAttribute("subTick",t,s,i)));r.name=JU.subTick,r.id=this._getNodeId(`${s}`),r.states=e,n.add(r)}))}this.subTickLineItems=t}}renderLabels(t,e,i){var n;const{dataFilter:s}=this.attribute.label;s&&$i(s)&&(e=s(e,i));const r=this._transformItems(e),a=hB({x:0,y:0,pickable:!1});a.name=`${JU.labelContainer}-layer-${i}`,a.id=this._getNodeId(`label-container-layer-${i}`),t.add(a);let o=0,l=0,h="center",c="middle";const d=un(null===(n=this.attribute.label)||void 0===n?void 0:n.state)?null:xn({},mU,this.attribute.label.state);return r.forEach(((t,e)=>{var n;const s=this._getLabelAttribute(t,e,r,i),u=gB(s);u.name=JU.label,u.id=this._getNodeId(`layer${i}-label-${t.id}`),u.states=d,a.add(u);const p=null!==(n=s.angle)&&void 0!==n?n:0;o=Math.max(o,u.AABBBounds.width()),l=Math.max(l,u.AABBBounds.height()),p&&(o=Math.abs(o*Math.cos(p)),l=Math.abs(l*Math.sin(p))),h=s.textAlign,c=s.textBaseline})),this.axisLabelLayerSize[i]={width:o,height:l,textAlign:h,textBaseline:c},a}renderTitle(t){const e=this.getTitleAttribute(),i=new bU(Object.assign({},e));i.name=JU.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return Un(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&$i(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;us(n[0])>us(n[1])?o=ls/2*(l.x>e.x?1:-1):h=ls/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===y[1]?f+=(this.axisLabelLayerSize[n-1].height+pn(this.attribute,"label.space",4))*n:f+=(this.axisLabelLayerSize[n-1].width+pn(this.attribute,"label.space",4))*n);const _=this.getVerticalCoord(t.point,f,u),v=this.getVerticalVector(f,u,_),b=p?p(t.label,t,e,i,n):t.label;let{style:x}=g;return x=$i(x)?xn({},eG.label.style,x(t,e,i,n)):x,x=xn({textAlign:this.getTextAlign(v),textBaseline:this.getTextBaseline(v,u)},x),$i(x.text)&&(x.text=x.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},_),{text:b,lineHeight:null==x?void 0:x.fontSize}),x)}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new qU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${JU.grid}-sub`:`${JU.grid}`,n.id=this._getNodeId(t),e.add(n)}}const sG={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&rG(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function rG(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function aG(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function lG(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=dr(t,i),r=dr(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=cr(t),l=cr(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:hr(t.angle);let f=i?t.angle+hs:hr(90-t.angle);const m=i?e.angle:hr(e.angle);let y=i?e.angle+hs:hr(90-e.angle);f>ds&&(f-=ds),y>ds&&(y-=ds);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(or(s,i)+or(s,n))/2>or(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function hG(t,e){"bottom"!==t&&"top"!==t||function(t,e){let i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var cG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return cU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:h="middle",space:c=4,textStyle:d={},autoRotate:u=!0,shape:p,background:g,state:f}=l,m=cG(l,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===h?y=0:"end"===h&&(y=1);const{verticalFactor:_=1}=this.attribute,v=-1*_,b=this.getTickCoord(y),x=this.getRelativeVector();let S=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+pn(this.attribute,"label.space",4);S+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===x[1])S+=this.axisLabelsContainer.AABBBounds.height()+(e-1)*t;else if(0===x[0])S+=this.axisLabelsContainer.AABBBounds.width()+(e-1)*t;else{Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{S+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const e=this.axisLabelLayerSize[0].textAlign,i="start"===e||"left"===e,n="center"===e,s=x[1]>0;S=1===v?s?i?S:n?S/2:0:i?t:n?S/2:S:s?i?0:n?S/2:S:i?S:n?S/2:0}}let w=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(w=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(w=Math.max(w,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const A=w+S+c,k=this.getVerticalCoord(b,A,!1),M=this.getVerticalVector(A,!1);let C,T,{angle:E}=m;if(C="start"===h?"start":"end"===h?"end":"center",Xi(E)&&u){E=dU(x,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else C=this.getTextAlign(M),T=this.getTextBaseline(M,!1);const R=Object.assign(Object.assign(Object.assign({},k),m),{textStyle:Object.assign({textAlign:C,textBaseline:T},d),state:un(f)?null:{text:f.text,shape:f.shape,panel:f.background}});return R.angle=E,p&&p.visible&&(R.shape=Object.assign({visible:!0},p.style),p.space&&(R.space=p.space)),g&&g.visible&&(R.panel=Object.assign({visible:!0},g.style)),R}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=uU,endAngle:r=pU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}else{n=xn({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(un(t))return;const{verticalLimitSize:o,label:l,title:h,line:c,tick:d,orient:u}=this.attribute,p=null!==(s=l.space)&&void 0!==s?s:4;let g=o,f=0,m=0;const y=(null==c?void 0:c.visible)?null!==(r=c.style.lineWidth)&&void 0!==r?r:1:0,_=(null==d?void 0:d.visible)?null!==(a=d.length)&&void 0!==a?a:4:0;(null==h?void 0:h.visible)&&(f=_U(h.text,h.textStyle).height,m=h.space),g&&(g=(g-p-m-f-y-_)/n);const{layoutFunc:v,autoRotate:b,autoRotateAngle:x,autoLimit:S,limitEllipsis:w,autoHide:A,autoHideMethod:k,autoHideSeparation:M}=l;$i(v)?v(t,e,i,this):(b&&function(t,e){if(un(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Es(e)})),hG(i,t),!lG(t))break}}(t,{labelRotateAngle:x,orient:u}),S&&an(g)&&g>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!un(t)&&an(i)&&t.forEach((t=>{const e=0===t.attribute.angle||Xi(t.attribute.angle)?"top"===s||"bottom"===s?null:i:i/Math.sin(t.attribute.angle);t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:g,ellipsis:w,orient:u}),A&&function(t,e){if(un(t))return;const i=t.filter(oG);if(un(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=$i(s)?s:sG[s]||sG.parity;if(n.length>=3&&aG(n,r)){do{n=a(n,r)}while(n.length>=3&&aG(n,r));n.length<3&&!Tn(i).attribute.opacity&&(n.length>1&&Tn(n).setAttribute("opacity",0),Tn(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:u,method:k,separation:M}))}}dG.defaultAttributes=eG;var uG,pG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=lB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=JU.line,c.id=this._getNodeId("line"),un(null==a?void 0:a.state)||(c.states=xn({},tG,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=uU,endAngle:i=pU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=uU,endAngle:i=pU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Is(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return cU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:h,innerRadius:c=0}=this.attribute,d=this.attribute.title,{space:u=4,textStyle:p={},shape:g,background:f,state:m}=d,y=pG(d,["space","textStyle","shape","background","state"]);let _=l,v=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(v=pn(this.attribute.label,"style.fontSize",12)+pn(this.attribute.label,"space",4));let b=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(b=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(b=Math.max(b,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const x=h+b+v+u;let S="middle",{position:w}=this.attribute.title;Xi(w)&&(w=0===c?"end":"middle"),"start"===w?(S="bottom",_={x:l.x,y:l.y-x}):"end"===w&&(S="top",_={x:l.x,y:l.y+x});const A=Object.assign(Object.assign(Object.assign({},_),y),{textStyle:Object.assign({textBaseline:S,textAlign:"center"},p),state:un(m)?null:{text:m.text,shape:m.shape,panel:m.background}}),{angle:k}=y;return A.angle=k,g&&g.visible&&(A.shape=Object.assign({visible:!0},g.style),g.space&&(A.space=g.space)),f&&f.visible&&(A.panel=Object.assign({visible:!0},f.style)),A}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=xn({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}gG.defaultAttributes=eG;class fG extends dC{constructor(){super(...arguments),this.mode=PA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return iU(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},iU(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!An(t.attribute,o.attribute)){const s=yn(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=an(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=ns.lastIndex=ss.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=ns.exec(t))&&(n=ss.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:es(i,n)})),r=ss.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=uG.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=uG.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=uG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=uG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=uG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===uG.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===uG.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=uG.endHandler):this.state.start=this.state.start+o:this._activeTag===uG.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===yj.env&&(yj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),yj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===uG.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:Kn(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===uG.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:Kn(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===uG.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=yG(t,["formatMethod"]),{formatMethod:s}=e,r=yG(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,xn({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,xn({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,xn({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,xn({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:i,size:n,orient:s,middleHandlerStyle:r}=this.attribute,{width:a,height:o}=n,l=null!==(e=null===(t=null==r?void 0:r.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let h,c,d;return(null==r?void 0:r.visible)?this._isHorizontal?(h=a,c=o-l,d={x:i.x,y:i.y+l}):(h=a-l,c=o,d={x:i.x+("left"===s?l:0),y:i.y}):(h=a,c=o,d=i),this._layoutAttrFromConfig={position:d,width:h,height:c},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:R,end:P}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+R*I,y:B.y,width:(P-R)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+R*D,width:I,height:(P-R)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+R*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(P-R)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(R+P)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+R*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(P-R)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(R+P)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{position:i,size:n,selectedBackgroundChartStyle:s}=this.attribute,{width:r,height:a}=n,{start:o,end:l}=this.state;this.computeBasePoints(),this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?i.x+o*r:i.x,y:this._isHorizontal?i.y:i.y+o*a,width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?i.x+o*r:i.x),y:-(this._isHorizontal?i.y:i.y+o*a),width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==s?void 0:s.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==s?void 0:s.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new bU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;Ki(t)&&Ki(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...Cn(a))}setUpdateStateCallback(t){$i(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){$i(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){$i(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){$i(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){$i(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){$i(t)&&(this._statePointToData=t)}};var vG,bG,xG;_G.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!1,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(vG||(vG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(bG||(bG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xG||(xG={}));class SG extends tU{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=hB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const wG={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:vG.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},AG={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},kG={label:{position:bG.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},MG={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},CG={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};let TG=class t extends SG{constructor(e){super(xn({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},AG[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new ZU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new bU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};TG.defaultAttributes=wG;let EG=class t extends SG{constructor(e){super(xn({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},MG[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=yB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new bU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};EG.defaultAttributes=kG;let RG=class t extends SG{constructor(e){super(xn({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=xG.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},CG[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=fB(Object.assign(Object.assign({},e),n)):"text"===i?o=new bU(Object.assign({},e)):"richText"===i?o=_B(Object.assign(Object.assign({},e),s)):"image"===i?o=mB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new ZU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=cB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};RG.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const PG={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class BG extends tU{getCurrent(){return this._current}constructor(t){super(xn({},BG.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new XM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new XM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(zG.item)){const t=i.delegate;t.hasState(OG.selected)?this._setLegendItemState(t,OG.selectedHover):this._setLegendItemState(t,OG.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===zG.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(FG.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(zG.item)){const t=i.delegate;t.removeState(OG.unSelectedHover),t.removeState(OG.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(OG.unSelectedHover),t.removeState(OG.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===zG.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(FG.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(zG.item)){const t=a.delegate;if(a.name===zG.focus){const e=t.hasState(OG.focus);t.toggleState(OG.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover,OG.focus]),this._setLegendItemState(t,OG.selected)})):(this._setLegendItemState(t,OG.selected),this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[OG.selected,OG.selectedHover,OG.focus]),this._setLegendItemState(e,OG.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(OG.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(OG.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(FG.legendItemClick,t);n?(this._removeLegendItemState(t,[OG.selected,OG.selectedHover]),this._setLegendItemState(t,OG.unSelected)):(this._setLegendItemState(t,OG.selected),this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover]))}else this._setLegendItemState(t,OG.selected),this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[OG.selected,OG.selectedHover]),this._setLegendItemState(e,OG.unSelected))}))}this._dispatchEvent(FG.legendItemClick,t)}}}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,OG.selected),this._removeLegendItemState(e,[OG.unSelected,OG.unSelectedHover])):(this._removeLegendItemState(e,[OG.selected,OG.selectedHover]),this._setLegendItemState(e,OG.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||un(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=hB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:c=[],autoPage:d}=this.attribute,u="horizontal"===o,{spaceCol:p=IG,spaceRow:g=DG,maxWidth:f,width:m,height:y}=t;Ki(f)?Ki(m)?this._itemWidthByUser=Math.min(f,m):this._itemWidthByUser=f:Ki(m)&&(this._itemWidthByUser=m),Ki(y)&&(this._itemHeightByUser=y);let _=!1,v=0,b=0,x=0,S=1,w=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!un(c)||(null==c?void 0:c.includes(t.label)),e),r=i.attribute.width,o=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,o),v=Math.max(r,v),this._itemMaxWidth=Math.max(r,this._itemMaxWidth),u?(S=s,Ki(l)&&(r>=l?(_=!0,e>0&&(b=0,x+=o+g,w+=1)):l0&&i.setAttributes({x:b,y:x}),b+=p+r):(S=n,Ki(h)&&h0&&i.setAttributes({x:b,y:x}),x+=g+o),a.add(i)}));let A=!1;_&&d&&w>S&&(A=this._renderPager(u)),A||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+pn(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i){const{id:n,label:s,value:r,shape:a}=t,{shape:o={},label:l={},value:h={},padding:c=0,background:d,focus:u,focusIconStyle:p={}}=this.attribute.item,g=Tr(c);let f;!1===d.visible?(f=hB({x:0,y:0,cursor:null==d?void 0:d.style.cursor}),this._appendDataToShape(f,zG.item,t,f)):(f=hB(Object.assign({x:0,y:0},null==d?void 0:d.style)),this._appendDataToShape(f,zG.item,t,f,null==d?void 0:d.state)),f.addState(e?OG.selected:OG.unSelected);const m=hB({x:0,y:0,pickable:!1});f.add(m);let y=0;const _=pn(o,"style.size",10),v=pn(o,"space",8),b=fB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},a),o.style));let x;Object.keys(o.state||{}).forEach((t=>{const e=o.state[t].fill||o.state[t].stroke;a.fill&&Xi(o.state[t].fill)&&e&&(o.state[t].fill=e),a.stroke&&Xi(o.state[t].stroke)&&e&&(o.state[t].stroke=e)})),this._appendDataToShape(b,zG.itemShape,t,f,null==o?void 0:o.state),b.addState(e?OG.selected:OG.unSelected),m.add(b);let S=0;if(u){const e=pn(p,"size",10);x=fB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},p),{visible:!1,pickMode:"imprecise",boundsPadding:g})),this._appendDataToShape(x,zG.focus,t,f),S=e}const w=gB(Object.assign(Object.assign({x:_/2+v,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==l?void 0:l.style.fontSize},null==l?void 0:l.style),{text:l.formatMethod?l.formatMethod(s,t,i):s}));this._appendDataToShape(w,zG.itemLabel,t,f,null==l?void 0:l.state),w.addState(e?OG.selected:OG.unSelected),m.add(w);const A=pn(l,"space",8);if(y+=_/2+v+w.AABBBounds.width()+A,Ki(r)){const n=pn(h,"space",u?8:0),s=gB(Object.assign(Object.assign({x:y+A,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==h?void 0:h.style.fontSize},null==h?void 0:h.style),{text:h.formatMethod?h.formatMethod(r,t,i):r}));this._appendDataToShape(s,zG.itemValue,t,f,null==h?void 0:h.state),s.addState(e?OG.selected:OG.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-g[1]-g[3]-_-v-w.AABBBounds.width()-A-S-n),h.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-_/2-g[1]-g[3]-S-n})),y=s.AABBBounds.x2+n,m.add(s)}else this._itemWidthByUser&&w.setAttribute("maxLineWidth",this._itemWidthByUser-g[1]-g[3]-_-v-S);x&&(x.setAttribute("x",y),m.add(x));const k=m.AABBBounds,M=k.width(),C=k.height(),T=this._itemWidthByUser||M+g[1]+g[3],E=this._itemHeightByUser||C+g[0]+g[2];return f.attribute.width=T,f.attribute.height=E,m.translateTo(-k.x1+g[3],-k.y1+g[0]),f}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+pn(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=IG,spaceRow:h=DG}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=LG}=o,f=jG(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new BG(Object.assign({layout:1===r?"horizontal":"vertical",total:99},xn({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new BG(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=hB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==zG.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==zG.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(OG.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=xn({},NG,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new XM(t,{item:e,data:e.data,selected:e.hasState(OG.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}};var WG;function UG(t){return en(t)?t:[t,t]}function GG(t){return t?"ew-resize":"ns-resize"}VG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:IG,spaceRow:DG,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:LG,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(WG||(WG={}));let YG=class t extends tU{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(xn({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===yj.env?(yj.addEventListener("pointermove",this._onHandlerPointerMove),yj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=Kn(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===yj.env)yj.removeEventListener("pointermove",this._onHandlerPointerMove),yj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===yj.env?(yj.addEventListener("pointermove",this._onTrackPointerMove),yj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=Kn(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=Kn(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===yj.env?(yj.removeEventListener("pointermove",this._onTrackPointerMove),yj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,c;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x,c=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,c=i);const d=o/c*(s-n)+n;if(Ki(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,d)}else this._updateHandler(r,o,d);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=Cn(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:h=!0}=this.attribute;let{value:c}=this.attribute;Xi(c)&&(c=[o,l]),this._currentValue={startValue:UG(c)[0],endValue:UG(c)[1]};const d="horizontal"===i;this._isHorizontal=d;const u=hB({x:0,y:0});u.name=WG.innerView,this.add(u),this._innerView=u;let p,g=0;if(r&&r.visible){p=gB(Object.assign({x:d?0:n/2,y:d?s/2:0,textAlign:d?"start":"center",textBaseline:d?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),p.name=WG.startText,u.add(p);const e=Ki(r.space)?r.space:0;g+=(d?p.AABBBounds.width():p.AABBBounds.height())+e}const f=hB({x:d?g:0,y:d?0:g});u.add(f);const m=hB({x:0,y:0});let y;if(m.name=WG.railContainer,this._railContainer=m,f.add(m),this._renderRail(m),g+=d?n:s,a&&a.visible){const t=Ki(a.space)?a.space:0;y=gB(Object.assign({x:d?g+t:n/2,y:d?s/2:g+t,textAlign:d?"start":"center",textBaseline:d?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),y.name=WG.endText,u.add(y)}this._renderTrack(m),h&&(this._renderHandlers(f),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=uB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=WG.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;Xi(c)&&(c=[i,n]);const d=a&&a.visible,u=this._isHorizontal,p=u?l:o,[g,f]=UG(c),m=(g-i)/(n-i)*p,y=this._renderHandler(Object.assign({x:u?m:l/2,y:u?o/2:m,size:s,strokeBoundsBuffer:0,cursor:!1===h?"default":GG(u)},r));if(y.name=WG.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,d){const e=this._renderHandlerText(g);e.name=WG.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(f-i)/(n-i)*p,a=this._renderHandler(Object.assign({x:u?e:l/2,y:u?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===h?"default":GG(u)},r));if(a.name=WG.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f);e.name=WG.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:h}=this.attribute;Xi(h)&&(h=[i,n]);const c=this._isHorizontal,d=c?r:s;let[u,p]=UG(h);e||(u=i);const g=hB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});g.name=WG.trackContainer;const f=qi(e)&&!0===e.draggableTrack;let m;m=!1===l?"default":!1===e||!1===f?"pointer":GG(c);const y=(p-u)/(n-i)*d,_=uB(Object.assign({x:c?(u-i)/(n-i)*d:0,y:c?0:(u-i)/(n-i)*d,width:c?y:r,height:c?s:y,cursor:m},a));_.name=WG.track,this._track=_,g.add(_),t.add(g)}_renderHandler(t){return fB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":GG(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),gB(f)}_bindEvents(){const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),qi(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===WG.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===WG.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===WG.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===WG.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new XM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};YG.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class $G extends HG{constructor(t){super(xn({},$G.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function XG(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}$G.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class KG extends HG{constructor(t){super(xn({},KG.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y,sizeBackground:_}=this.attribute,v=hB({x:0,y:0});this._innerView.add(v);const b=new YG({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:XG(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=dB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+pn(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}KG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};let qG=class t extends tU{constructor(e){super(xn({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,R,P,B,I,D,L,O,F,z,H,j,N,V,W,U,G,Y,$,X,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot;const{text:lt,textStyle:ht,subtext:ct,subtextStyle:dt,width:ut,height:pt,minWidth:gt,maxWidth:ft,minHeight:mt,maxHeight:yt,align:_t,verticalAlign:vt,padding:bt=0}=this.attribute,xt=Tr(bt),St=this.createOrUpdateChild("title-container",{x:xt[3],y:xt[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ht?void 0:ht.visible))if(ht&&Ki(null==ht?void 0:ht.character)){const t={x:null!==(e=ht.x)&&void 0!==e?e:0,y:null!==(i=ht.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ht.width)&&void 0!==n?n:ut)&&void 0!==s?s:0,height:null!==(a=null!==(r=ht.height)&&void 0!==r?r:pt)&&void 0!==a?a:0,ellipsis:null===(o=ht.ellipsis)||void 0===o||o,wordBreak:null!==(l=ht.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ht.maxHeight,maxWidth:ht.maxWidth,textConfig:ht.character};this._mainTitle=St.createOrUpdateChild("mainTitle",t,"richtext")}else Ki(lt)&&(this._mainTitle=St.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[lt]},ht),{maxLineWidth:null!==(h=null==ht?void 0:ht.maxLineWidth)&&void 0!==h?h:ut,heightLimit:null==ht?void 0:ht.heightLimit,lineClamp:null==ht?void 0:ht.lineClamp,ellipsis:null===(c=null==ht?void 0:ht.ellipsis)||void 0===c||c,x:0,y:0}),"wrapText"));const wt=this._mainTitle?null===(d=this._mainTitle)||void 0===d?void 0:d.AABBBounds.height():0,At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.width():0;if(!1!==(null===(p=this.attribute)||void 0===p?void 0:p.visible)&&!1!==(null==dt?void 0:dt.visible))if(dt&&Ki(null==dt?void 0:dt.character)){const t={x:null!==(g=dt.x)&&void 0!==g?g:0,y:null!==(f=dt.y)&&void 0!==f?f:wt,width:null!==(y=null!==(m=dt.width)&&void 0!==m?m:ut)&&void 0!==y?y:0,height:null!==(v=null!==(_=dt.height)&&void 0!==_?_:pt)&&void 0!==v?v:0,ellipsis:null===(b=dt.ellipsis)||void 0===b||b,wordBreak:null!==(x=dt.wordBreak)&&void 0!==x?x:"break-word",maxHeight:dt.maxHeight,maxWidth:dt.maxWidth,textConfig:dt.character};this._subTitle=St.createOrUpdateChild("subTitle",t,"richtext")}else Ki(ct)&&(this._subTitle=St.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[ct]},dt),{maxLineWidth:null!==(S=null==dt?void 0:dt.maxLineWidth)&&void 0!==S?S:ut,heightLimit:null==dt?void 0:dt.heightLimit,lineClamp:null==dt?void 0:dt.lineClamp,ellipsis:null===(w=null==dt?void 0:dt.ellipsis)||void 0===w||w,x:0,y:wt}),"wrapText"));const kt=this._subTitle?null===(A=this._subTitle)||void 0===A?void 0:A.AABBBounds.height():0,Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.width():0;let Ct=Math.max(At,Mt),Tt=wt+(null!==(M=null==dt?void 0:dt.height)&&void 0!==M?M:kt);if(Ki(ut)&&(Ct=ut,null===(C=this._mainTitle)||void 0===C||C.setAttribute("maxLineWidth",ut),null===(T=this._subTitle)||void 0===T||T.setAttribute("maxLineWidth",ut)),Ki(pt)&&(Tt=pt),Ki(gt)&&Ctft&&(Ct=ft)),Ki(mt)&&Ttyt&&(Tt=yt)),St.attribute.width=Ct+xt[1]+xt[3],St.attribute.height=Tt+xt[0]+xt[2],Ki(_t)||Ki(null==ht?void 0:ht.align)){const t=(null==ht?void 0:ht.align)?null==ht?void 0:ht.align:_t,e=null!==(L=null==ht?void 0:ht.width)&&void 0!==L?L:At;"left"===t?(null===(O=this._mainTitle)||void 0===O||O.setAttribute("x",0),null===(F=this._mainTitle)||void 0===F||F.setAttribute("textAlign","left")):"center"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e/2),null===(H=this._mainTitle)||void 0===H||H.setAttribute("textAlign","center")):"right"===t&&(null===(j=this._mainTitle)||void 0===j||j.setAttribute("x",e),null===(N=this._mainTitle)||void 0===N||N.setAttribute("textAlign","right"))}if(Ki(vt)||Ki(null==ht?void 0:ht.verticalAlign)){const t=(null==ht?void 0:ht.verticalAlign)?null==ht?void 0:ht.verticalAlign:vt,e=(null==ht?void 0:ht.height)?null==ht?void 0:ht.height:Ct;"top"===t?(null===(V=this._mainTitle)||void 0===V||V.setAttribute("y",0),null===(W=this._mainTitle)||void 0===W||W.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(Ki(_t)||Ki(null==dt?void 0:dt.align)){const t=(null==dt?void 0:dt.align)?null==dt?void 0:dt.align:_t,e=null!==(X=null==dt?void 0:dt.width)&&void 0!==X?X:Mt;"left"===t?(null===(K=this._subTitle)||void 0===K||K.setAttribute("x",0),null===(q=this._subTitle)||void 0===q||q.setAttribute("textAlign","left")):"center"===t?(null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("x",e/2),null===(J=this._subTitle)||void 0===J||J.setAttribute("textAlign","center")):"right"===t&&(null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("x",e),null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("textAlign","right"))}if(Ki(vt)||Ki(null==ht?void 0:ht.verticalAlign)){const t=(null==dt?void 0:dt.verticalAlign)?null==dt?void 0:dt.verticalAlign:vt,e=wt,i=null!==(et=null==dt?void 0:dt.height)&&void 0!==et?et:0;"top"===t?(null===(it=this._subTitle)||void 0===it||it.setAttribute("y",e),null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("textBaseline","top")):"middle"===t?(null===(st=this._subTitle)||void 0===st||st.setAttribute("y",e+i/2),null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(at=this._subTitle)||void 0===at||at.setAttribute("y",e+i),null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("textBaseline","bottom"))}}};qG.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const ZG={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};let JG=class extends tU{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(Ki(i))if(!1!==i.visible){const t=xn({},pn(ZG,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:Ki(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&an(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&an(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(Ki(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=Cn(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=xn({},pn(ZG,"content.style"),e.style),c=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:Ki(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&an(a)&&this._setAutoFit(a,c,e),e.autoLimit&&an(r)&&c.setAttribute("maxLineWidth",a),s.push(c);const d=(null==e?void 0:e.space)?e.space:0;h+=c.AABBBounds.height()+d}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=_U(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",Ki(i.style.lineHeight)?i.style.lineHeight:s)}}};class QG extends XR{constructor(t){super(t)}}var tY,eY;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(tY||(tY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(eY||(eY={}));class iY extends tU{constructor(t){super(xn({},iY.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},iY.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},iY.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},iY.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},iY.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{Xi(this._playController)&&(this._playController=new QG(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{Xi(this._backwardController)&&(this._backwardController=new QG(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{Xi(this._forwardController)&&(this._forwardController=new QG(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()}))},this._createCustomEvent=t=>{var e;const i=new XM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{const t=this._createCustomEvent(tY.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(tY.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(tY.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(tY.OnBackward);this.dispatchEvent(t)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}iY.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},iY.defaultAttributes={visible:!0,[eY.Start]:{},[eY.Pause]:{},[eY.Backward]:{},[eY.Forward]:{}};const nY={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},sY=[200,10];var rY,aY;!function(t){t.Default="default",t.Reverse="reverse"}(rY||(rY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(aY||(aY={}));const oY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===rY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===rY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},lY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===rY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===rY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},hY=t=>"top"===t||"bottom"===t;class cY extends tU{constructor(t){super(xn({},cY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;an(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=fs(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:an(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(hY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:sY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:sY[1];s.layout="vertical",s.railWidth=e,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new YG(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return hY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new iY(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=hY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:sY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=rn(i)?i:fs(i[0],i[1]);return t+e.space+n}),0),l=(hY(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=rn(s)?s:fs(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:hY(this._orient)?t+n:(this._size.width-r)/2,y:hY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:hY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:hY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=rn(s)?s:fs(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:hY(this._orient)?t+n:(this._size.width-r)/2,y:hY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){var i;const n=new XM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}cY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},nY),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},nY),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},nY),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},nY),{key:"backward",position:"start"})}};class dY extends cY{constructor(t){super(xn({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:rY.Default,this._dataIndex=Xi(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(tY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(tY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(tY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(tY.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(aY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(oY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||lY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===rY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(aY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(aY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(aY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),yj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(aY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,yj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(aY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(aY.OnChange),this.dispatchCustomEvent(aY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(aY.OnChange),this.dispatchCustomEvent(aY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var uY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class pY extends cY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(tY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(tY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(tY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(tY.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,n=i/this._maxIndex;this._elapsed=n*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)}))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(aY.OnChange))},this.play=()=>uY(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(aY.OnPlay),this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,yj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(aY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,yj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(aY.OnPause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(aY.OnBackward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(aY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const gY={debounce:Qn,throttle:ts};let fY=class t extends tU{constructor(e){super(xn({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",gY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(vr(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:yn(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=yB(Object.assign({points:yn(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return xn(t,...i,{shape:s.every(Xi)?void 0:xn({},...s),key:r.every(Xi)?void 0:xn({},...r),value:a.every(Xi)?void 0:xn({},...a)})},yY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:Cn(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},_Y={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:gU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:gU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:gU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ts).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},vY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let bY=class t extends tU{constructor(e){super(xn({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=Tr(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const c=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",xn({symbolType:"circle"},c.shape,{visible:nU(c)&&nU(c.shape)}),"symbol"),c.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:nU(c)&&nU(c.value)},yY(c.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:nU(c)&&nU(c.value)},c.value),"text");const d=nU(c.shape)?c.shape.size+c.shape.spacing:0,{textAlign:u,textBaseline:p}=c.value,g=n.width-h[3]-h[0]-d;"center"===u?this._tooltipTitle.setAttribute("x",d+g/2):"right"===u||"end"===u?this._tooltipTitle.setAttribute("x",d+g):this._tooltipTitle.setAttribute("x",d),"bottom"===p?this._tooltipTitle.setAttribute("y",c.height):"middle"===p?this._tooltipTitle.setAttribute("y",c.height/2):this._tooltipTitle.setAttribute("y",0);const f=nU(c)?c.height+c.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+f);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!nU(l))return;const h=`tooltip-content-${n}`,c=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let d=0;if(nU(l.shape)&&c.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(d+=l.shape.size+l.shape.spacing),nU(l.key)){let t;t=l.key.multiLine?c.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},yY(l.key)),{textBaseline:"top"}),"richtext"):c.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",d+s/2):"right"===e||"end"===e?t.setAttribute("x",d+s):t.setAttribute("x",d),t.setAttribute("y",0),d+=s+l.key.spacing}if(nU(l.value)){let t;t=l.value.multiLine?c.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},yY(l.value)),{textBaseline:"top"}),"richtext"):c.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";Ki(l.value.textAlign)?e=l.value.textAlign:nU(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",d+r/2):"right"===e||"end"===e?t.setAttribute("x",d+r):t.setAttribute("x",d),d+=r,t.setAttribute("y",0),c.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>vY.includes(t)))?(this._mergeAttributes(e,n),Xi(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&nU(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=nU(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=yU(u),v=yU(p);let b=0;if(nU(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(nU(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&YR[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return mY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return mY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};bY.defaultAttributes=_Y;const xY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class SY extends JW{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=tn(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}zV(aV.lineAxis,((t,e)=>new dG(t,e))),zV(aV.circleAxis,(t=>new gG(t)));class wY extends SY{constructor(t,e,i){super(t,sV.axis,e),this.spec.componentType=sV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=xn({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=FV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=vV(s,e,i,n);const c=jN(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=jN(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=jN(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case aV.lineAxis:return((t,e,i)=>{var n,s;const r=xY.axis;return t?xn({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):xn({},r,null!=e?e:{})})(u,h,p);case aV.circleAxis:return((t,e,i)=>{var n,s;const r=xY.circleAxis;return t?xn({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):xn({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(Xi(e)){const i=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?aV.circleAxis:aV.lineAxis,this._axisComponentType}}zV(oV.discreteLegend,(t=>new VG(t))),zV(oV.colorLegend,(t=>new $G(t))),zV(oV.sizeLegend,(t=>new KG(t)));class AY extends SY{constructor(t,e){super(t,sV.legend,e),this.spec.componentType=sV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==oV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":FG.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=tn(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=tn(t)?this.view.getDataById(t):t,l=tn(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,rV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=FV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=vV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case oV.discreteLegend:return((t,e)=>{const i=xY.discreteLegend;return t?xn({},i,{items:Array.from(new Set(Cn(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=UN(n),r=s?Object.assign(Object.assign({},xY.discreteLegend.items[0].shape),{fill:s,stroke:s}):xY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):xn({},i,null!=e?e:{})})(o,a);case oV.colorLegend:return((t,e)=>{const i=xY.colorLegend;if(!t)return xn({},i,null!=e?e:{});const n=t.domain();return xn({},i,{colors:t.range().slice(),min:n[0],max:Tn(n)},null!=e?e:{})})(o,a);case oV.sizeLegend:return((t,e)=>{const i=xY.sizeLegend;if(!t)return xn({},i,null!=e?e:{});const n=t.domain();return xn({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&Nl(i)){const t=e.getScale().range();UN(null==t?void 0:t[0])?this._legendComponentType=oV.colorLegend:this._legendComponentType=oV.sizeLegend}else this._legendComponentType=oV.discreteLegend}return this._legendComponentType}}zV(lV.lineCrosshair,(t=>new SU(t))),zV(lV.rectCrosshair,(t=>new wU(t))),zV(lV.sectorCrosshair,(t=>new kU(t))),zV(lV.circleCrosshair,(t=>new AU(t))),zV(lV.polygonCrosshair,(t=>new MU(t)));const kY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(Wl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Ps(Ds(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else Nl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Ds(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class MY extends SY{constructor(t,e){super(t,sV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case lV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=xY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return xn({},l,kY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case lV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=xY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=kY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=xn({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case lV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=xY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(Wl(e.type)){const i=Ps(Ds(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else Nl(e.type)&&(f=Ds(u,t));return xn({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case lV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=xY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(Wl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else Nl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return xn({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case lV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=xY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(Wl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else Nl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return xn({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=sV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=FV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=vV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?lV.sectorCrosshair:lV.rectCrosshair:"radius"===n?lV.circleCrosshair:"radius-polygon"===n?lV.polygonCrosshair:lV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}zV(sV.slider,(t=>new YG(t)));class CY extends JW{constructor(t,e){super(t,sV.slider,e),this.spec.componentType=sV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=tn(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=tn(t)?this.view.getDataById(t):t,a=tn(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,rV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>xn({},xY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(Xi(this.spec.min)?0:jN(this.spec.min,i,t,e),Xi(this.spec.max)?1:jN(this.spec.max,i,t,e),vV(n,t,e,i))}),e}),{});this._encoders=e}}zV(sV.label,(t=>new YU(t)));let TY=class extends JW{constructor(t,e){super(t,sV.label,e),this.spec.componentType=sV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Cn(this.spec.target).map((t=>tn(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Cn(t).map((t=>tn(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=Cn(this.spec.target).map((t=>tn(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=jN(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=xY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case nV.line:r=xY.lineLabel;break;case nV.rect:r=xY.rectLabel;break;case nV.symbol:r=xY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[SV],n=vV(i,e.getDatum(),e,s),o=xn({},r.data[0],n);a.push(o)}}));const o=jN(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return xn({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!Xi(t)));return xn({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};zV(sV.datazoom,(t=>new _G(t)));class EY extends JW{constructor(t,e){super(t,sV.datazoom,e),this.spec.componentType=sV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!Xi(this.spec.preview)){const t=this.spec.preview.data,e=tn(t)?this.view.getDataById(t):t;this.detach(e),this.detach($N(this.spec.preview.x,this.view)),this.detach($N(this.spec.preview.y,this.view)),this.detach($N(this.spec.preview.x1,this.view)),this.detach($N(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=tn(t)?this.view.getDataById(t):t;this.attach(r),this.attach($N(e,this.view)),this.attach($N(i,this.view)),this.attach($N(n,this.view)),this.attach($N(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=tn(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=tn(t)?this.view.getDataById(t):t,h=tn(e)?(t,i)=>{if(Xi(i.start)||Xi(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,rV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),h),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},xY.datazoom,t),n=FV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=tn(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=vV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=xY.datazoom;return t?xn({},l,{previewData:t,previewXCallback:e?t=>vV({x:e},t,r,a).x:null,previewYCallback:i?t=>vV({y:i},t,r,a).y:null,previewX1Callback:n?t=>vV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>vV({y1:s},t,r,a).y1:null},null!=o?o:{}):xn({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=tn(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}zV(cV.continuousPlayer,(t=>new pY(t))),zV(cV.discretePlayer,(t=>new dY(t)));let RY=class extends JW{constructor(t,e){super(t,sV.player,e),this.spec.componentType=sV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=en(t)?null:tn(t)?this.view.getDataById(t):t;this.detach(e)}const r=en(e)?null:tn(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=tn(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(aY.OnChange,this._filterCallback),this.spec.target=void 0;const l=tn(t)?this.view.getDataById(t):t;return this._filterData(o,l,rV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(aY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=xn({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:FV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=vV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=en(o)?null:tn(o)?this.view.getDataById(o):o,h=en(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>xn({},xY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>xn({},xY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};zV(sV.tooltip,(t=>new bY(t)));let PY=class extends JW{constructor(t,e){super(t,sV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ts(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Ts).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>xn({},xY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=sV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=Cn(this.spec.target).map((t=>tn(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=Cn(t).map((t=>tn(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!Xi(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=vV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return Cn(t).reduce(((t,e)=>(t=t.concat(zN(e.visible,this.view)),YN(e.key)||(t=t.concat(zN(e.key,this.view))),YN(e.value)||(t=t.concat(zN(e.value,this.view))),YN(e.symbol)||(t=t.concat(zN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=jN(t.visible,n,e,i);return o=!!Xi(o)||!!o,s=YN(t.key)?dl(t.key.field)(e):jN(t.key,n,e,i),s=Xi(s)?void 0:Zi(s)?s:{text:s},r=YN(t.value)?dl(t.value.field)(e):jN(t.value,n,e,i),r=Xi(r)?void 0:Zi(r)?r:{text:r},a=YN(t.symbol)?dl(t.symbol.field)(e):jN(t.symbol,n,e,i),a=Xi(a)?void 0:Zi(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?Cn(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var BY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class IY extends RW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],Xi(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=zN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];Cn(t.source).forEach((t=>{const i=VN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return BY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return Xi(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return Xi(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Cn(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=IW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=IW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Cn(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=Cn(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function DY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function LY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,DY(t,e,s,n)}class OY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return DY(this.nodes,e,0,this.compare),LY(this.nodes,e,null,this.compare)}return this.nodes.push(t),DY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),DY(this.nodes,e,0,this.compare),LY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,LY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class FY{constructor(t){this.list=[],this.ids={},this.idFunc=t||ul}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var zY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class HY{constructor(){this.grammars=[],this.logger=ll(),this._curRank=0,this._committed=new FY((t=>t.uid)),this._heap=new OY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return zY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>Xi(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new FY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return zY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const jY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===nV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class NY{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(uV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return DT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{$k.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(uV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Rj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(uV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(uV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(uV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new eC(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=qi(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new sC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class VY extends RW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?jN(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(en(t)&&en(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function JY(t,e,i){jN(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=jN(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),Xi(null==n?void 0:n.clamp)||($i(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function QY(t,e,i){KY(t,e,i),qY(t,e,i),ZY(t,e,i),JY(t,e,i)}function t$(t,e,i){t.round&&e.round(jN(t.round,i,e),!0),t.padding&&e.padding(jN(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(jN(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(jN(t.paddingOuter,i,e),!0),t.align&&e.align(jN(t.align,i,e),!0)}function e$(t,e,i,n){const s=t.field,r=NN(t.data,i),a=tn(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),Nl(e.type)?(n&&a.filter((t=>rn(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function i$(t,e,i){if(UY(t.domain)?e.domain(e$(t.domain,e,i,!0),!0):e.domain(jN(t.domain,i,e),!0),UY(t.range))e.range(e$(t.range,e,i),!0);else if(GY(t.range)){const n=NN(t.range.coordinate,i);!function(t){switch(t){case jl.Quantile:case jl.Quantize:case jl.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(jN(t.range,i,e),!0);switch(t.type){case"linear":QY(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){t$(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){QY(t,e,i);const n=jN(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){KY(t,e,i),ZY(t,e,i),JY(t,e,i);const n=jN(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){QY(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){QY(t,e,i);const n=jN(t.constant,i,e);an(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){KY(t,e,i),ZY(t,e,i),JY(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){KY(t,e,i),qY(t,e,i),ZY(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class n$ extends RW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=WY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=WY(this.spec.type)),i$(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return Xi(this.spec.domain)||this.detach($Y(this.spec.domain,this.view)),this.spec.domain=t,this.attach($Y(t,this.view)),this.commit(),this}range(t){return Xi(this.spec.range)||this.detach($Y(this.spec.range,this.view)),this.spec.range=t,this.attach($Y(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!Xi(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!Xi(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return Xi(e)?null:this.parameters()[e]}configure(t){return this.detach(XY(this.spec.type,t,this.view)),Xi(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(XY(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let s$=-1;const r$=[VW,WW,YW,UW,GW,$W,XW],a$=t=>{var e,i,n,s;return rn(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},o$=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:DV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:PV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:RV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:IV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},l$=(t,e)=>(null==e?void 0:e.debounce)?Qn(t,e.debounce):(null==e?void 0:e.throttle)?ts(t,e.throttle):t,h$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:HW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):NV[t]?(i.markType=t,i.source=e):i.source=t===zW?zW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},c$={},d$=()=>c$;let u$=class extends ZW{constructor(t,e){super(t,nV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return gV.rect}evaluateJoin(t){return super.evaluateJoin(MV)}};function p$(t,e){if(an(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return an(t)?t*e:0}return 0}function g$(t,e){return Math.min(t<0?t+e:t-1,e)}function f$(t,e,i){let n=g$(t,i),s=g$(e,i);if(an(t)||an(e)?an(t)?an(e)||(n=g$(Math.max(0,s-1),i)):s=g$(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const m$=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>p$(t,i))),u=l.map((t=>p$(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=f$(e,i,r),{start:h,end:c}=f$(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Cs).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},y$=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=vl(r.maxChildWidth,s.width()),o=vl(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=a$(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==nV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if($i(r))r.call(null,t,s,a,e);else if($i(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=y$(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(UW,o),i.updateSignal(GW,l),i.updateSignal(YW,h)}else y$(t,s,a,e);else"grid"===r.display&&m$(t,s,a);_$(s,e,i)}))};class v$ extends ZW{constructor(t,e,i){super(t,nV.glyph,i),this.glyphType=e,this.glyphMeta=qN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=WV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let b$=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return Xi(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return Xi(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return en(t)?(i.x=t[0],i.y=t[1]):rn(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new Ls,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class x$ extends b${constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(an(t.x1)||an(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(an(t.x1)||an(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=Xi(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=Xi(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=en(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class S$ extends b${constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Ps(s);const r=Un(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function w$(t){switch(t){case"cartesian":default:return new x$;case"polar":return new S$}}class A$ extends RW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=w$(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=w$(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,h;!Xi(t.start)&&e.start(null!==(n=jN(t.start,i))&&void 0!==n?n:[0,0]),!Xi(t.end)&&e.end(null!==(s=jN(t.end,i))&&void 0!==s?s:[0,0]),!Xi(t.origin)&&e.origin(null!==(r=jN(t.origin,i))&&void 0!==r?r:[0,0]);const c=[];if(!Xi(t.translate)){const e=jN(t.translate,i);c.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!Xi(t.rotate)){const e=jN(t.rotate,i);c.push({type:"rotate",angle:null!=e?e:0})}if(!Xi(t.scale)){const e=jN(t.scale,i);c.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(h=null==e?void 0:e[1])&&void 0!==h?h:1}})}Xi(t.transpose)||jN(t.transpose,i)&&c.push({type:"transpose"}),e.applyTransforms(c)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const k$=Symbol.for("key");class M${diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new pW(t,i);return s.setCallback(((t,e,i)=>{Xi(e)?n.exit.push({prev:i[0]}):Xi(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(uW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==nV.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==nV.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=uW(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=uW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!Xi(e.morphElementKey)){const i=WN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new pW(t,i);return s.setCallback(((t,e,i)=>{Xi(e)?n.exit.push({prev:i}):Xi(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(uW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:k$})),r=uW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:k$}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==k$){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=jN(i.animation.delay,s,o,l),d=jN(i.animation.duration,s,o,l),u=jN(i.animation.oneByOne,s,o,l),p=jN(i.animation.splitPath,s,o,l),g=an(u)&&u>0?t=>rn(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?AT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:kT)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);bT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?AT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:kT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>mT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>_T(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:EA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new vT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:_C,null!==(l=i.easing)&&void 0!==l?l:vC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:EA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new xT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:_C,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:vC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):bT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class C${constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=tn(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),Xi(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),Xi(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),Xi(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),Xi(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class T${constructor(t){this.view=t}stop(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.stop()})),this}pause(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.pause()})),this}resume(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.resume()})),this}enable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.enable()})),this}disable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.disable()})),this}enableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.enableAnimationState(t)})),this}disableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.disableAnimationState(t)})),this}animate(){return this.view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){}}class E$ extends ZW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=HN(e)?null:Object.keys(e).reduce(((t,n)=>(GN(e[n])&&(t[n]=NN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=vV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===jl.Band){if(!Xi(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===jl.Band){if(!Xi(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:gV.rect}addGraphicItem(t,e){const i=VV(this,this.coord&&"polar"===this.coord.output().type?nV.arc:nV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class R$ extends ZW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=HN(e)?null:Object.keys(e).reduce(((t,n)=>(GN(e[n])&&(t[n]=NN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=vV(e,t,i,s);if(Xi(r.size)){const t=n.x?bV(n.x):void 0,e=n.y?bV(n.y):void 0;Xi(t)&&Xi(e)?r.size=10:Xi(t)?r.size=e:Xi(e)&&(r.size=t),r.size=[t,e]}return Xi(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(rn(i.padding)&&i.padding>0)t.size=en(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(en(i.padding)&&2===i.padding.length){const e=en(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(gV.symbol)}release(){super.release(),this._encoders=null}}var P$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class B$ extends Ui{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=Qn((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[SV],s=KW(0,t,n,e,HW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){tn(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new VY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new IY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new n$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new A$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=tn(e)?this.getMarkById(e):e;let s;switch(t){case nV.group:s=new u$(this,n);break;case nV.glyph:s=new v$(this,null==i?void 0:i.glyphType,n);break;case nV.component:s=((t,e,i,n)=>{switch(e){case sV.axis:return new wY(t,i,n);case sV.legend:return new AY(t,i);case sV.crosshair:return new MY(t,i);case sV.slider:return new CY(t,i);case sV.label:return new TY(t,i);case sV.datazoom:return new EY(t,i);case sV.player:return new RY(t,i);case sV.tooltip:return new PY(t,i)}return new JW(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case nV.interval:s=new E$(this,t,n);break;case nV.cell:s=new R$(this,t,n);break;default:s=new ZW(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(nV.group,t)}glyph(t,e){return this.mark(nV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(nV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(nV.component,t,{componentType:sV.axis,mode:e})}legend(t){return this.mark(nV.component,t,{componentType:sV.legend})}crosshair(t){return this.mark(nV.component,t,{componentType:sV.crosshair})}slider(t){return this.mark(nV.component,t,{componentType:sV.slider})}label(t){return this.mark(nV.component,t,{componentType:sV.label})}datazoom(t){return this.mark(nV.component,t,{componentType:sV.datazoom})}player(t){return this.mark(nV.component,t,{componentType:sV.player})}tooltip(t){return this.mark(nV.component,t,{componentType:sV.tooltip})}customized(t,e){const i=(t=>c$[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=tn(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&r$.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(uV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++s$;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(VW,t.width),this.updateSignal(WW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=d$();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(uV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=dV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:VW,value:null!==(i=t[VW])&&void 0!==i?i:0},{id:WW,value:null!==(n=t[WW])&&void 0!==n?n:0},{id:YW,value:a$(null!==(s=t[YW])&&void 0!==s?s:e[YW])},{id:UW,update:{callback:(t,e)=>{const i=a$(e[YW]);return e[VW]-i.left-i.right},dependency:[VW,YW]}},{id:GW,update:{callback:(t,e)=>{const i=a$(e[YW]);return e[WW]-i.top-i.bottom},dependency:[WW,YW]}},{id:$W,update:{callback:(t,e)=>{const i=a$(e[YW]);return(t||new Cs).setValue(i.left,i.top,i.left+e[UW],i.top+e[GW])},dependency:[UW,GW,YW]}},{id:XW,value:null!==(r=t[XW])&&void 0!==r?r:e[XW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===nV.glyph?{glyphType:t.glyphType}:t.type===nV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(VW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(WW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(UW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(GW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(YW);if(arguments.length){const i=a$(t);return this.updateSignal(e,i),i}return a$(e.output())}autoFit(t){const e=this.getSignalById(XW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById($W);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=dV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===nV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||_$;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(uV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(uV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(uV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{jY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(uV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(uV.BEFORE_MARK_RENDER_END),jY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(uV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return P$(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return P$(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(uV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(uV.AFTER_DO_RENDER)}evaluate(t){var e,i;return P$(this,void 0,void 0,(function*(){const n=o$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=dV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=dV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=dV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=o$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=dV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=dV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=dV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!r$.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return jY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=Ha(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return P$(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(VW,t)),e!==this.height()&&(n=!0,this.updateSignal(WW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,h=h$(e);if(!h)return;const{source:c,type:d}=h,u=Xi((m=h).markId)?t=>t&&t.mark.id()===m.markId:Xi(m.markName)?t=>t&&t.mark.name()===m.markName:Xi(m.type)?t=>t&&t.mark.markType===m.type:()=>!0,p=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:tn(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),g=FN(l,this),f=l$(((t,e)=>{const n=c===HW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===zW&&(t=KW(0,t,e,d,zW));let s=!1;if((!i||i(t))&&(!u||u(e))&&p.length){const e=g.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});p.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var m;if(c===HW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||qi(n)&&!n[i])}(this._eventConfig,HW,d))return this.addEventListener(d,f,jW),()=>{this.removeEventListener(d,f)}}else if(c===zW)return yj.addEventListener(d,f),this._eventListeners.push({type:d,source:yj,handler:f}),()=>{yj.removeEventListener(d,f);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===yj&&t.handler===f));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);tn(e)?i.type=e:qi(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:NW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?tn(r)?r:r.user:NW,o=r&&a===r.user&&(s===r.element||Xi(s)&&Xi(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==NW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!Xi(document)&&document.body:this.container;return e?Xi(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new NY(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e,i;this.grammars=new C$((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new C$((t=>t.id())),this._options.logger&&(i=this._options.logger,ol=i),this.logger=ll(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new HY,this.animate=new T$(this),this._morph=new M$,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{en(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[HW,zW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&yj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=dV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==nV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=yj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&yj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),BN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const I$=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{PN(e,t[e],!0)}))}))};I$(xV);const D$=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var L$,O$,F$;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(L$||(L$={})),function(t){t.chart="chart",t.window="window"}(O$||(O$={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(F$||(F$={}));const z$=`${Jj}_waterfall_default_seriesField`,H$=`${Jj}_DEFAULT_DATA_INDEX`,j$=`${Jj}_DEFAULT_DATA_KEY`,N$=`${Jj}_DEFAULT_DATA_SERIES_FIELD`,V$=`${Jj}_DEFAULT_SERIES_STYLE_NAME`;var W$;!function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.Built_In=99]="Built_In"}(W$||(W$={}));const U$=`${Jj}_STACK_START`,G$=`${Jj}_STACK_END`,Y$=`${Jj}_STACK_START_PERCENT`,$$=`${Jj}_STACK_END_PERCENT`,X$=`${Jj}_STACK_START_OffsetSilhouette`,K$=`${Jj}_STACK_END_OffsetSilhouette`,q$=`${Jj}_SEGMENT_START`,Z$=`${Jj}_SEGMENT_END`;var J$,Q$;!function(t){t[t.Axis_Grid=100]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark"}(J$||(J$={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(Q$||(Q$={}));const tX=["linear","radial","conical"],eX={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},iX={innerRadius:0,outerRadius:1,startAngle:MN,endAngle:CN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var nX,sX;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(nX||(nX={})),function(t){t.middle="middle",t.start="start",t.end="end"}(sX||(sX={}));const rX={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,tickSize:Oj,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Oj/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Dj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Dj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},aX={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},oX={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},lX={name:"light",padding:12,fontFamily:Ij,colorScheme:{default:{dataScheme:[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Dj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Dj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Kj,line:Uj,area:Fj,bar:zj,bar3d:Hj,pie:Yj,pie3d:$j,map:Gj,radar:Xj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:jj,funnel3d:Nj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:qj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:Wj,treemap:Zj,sunburst:iX,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Dj},minLabel:{position:sX.end},maxLabel:{position:sX.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Dj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Dj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...oX,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...oX,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...oX},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...oX}},axis:rX,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10}},axisY:{label:{space:20},title:{space:20,autoRotate:!0}},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Dj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Dj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!1,background:{size:5,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:8,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{lineWidth:1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{lineWidth:1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:aX,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Lj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Dj,lineHeight:Lj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Dj,fontFamily:Ij}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Dj,fontFamily:Ij}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}}}},hX=new Map([[lX.name,lX]]),cX=lX.name;class dX{static instances=new Map;static registerInstance(t){dX.instances.set(t.id,t)}static unregisterInstance(t){dX.instances.delete(t.id)}static getInstance(t){return dX.instances.get(t)}static instanceExist(t){return dX.instances.has(t)}static forEach(t,e=[],i){const n=Cn(e);return dX.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class uX{static themes=new Map;static _currentThemeName=cX;static registerTheme(t,e){t&&uX.themes.set(t,xn({},uX.getDefaultTheme(),e))}static getTheme(t){return uX.themes.get(t)||uX.getDefaultTheme()}static removeTheme(t){return uX.themes.delete(t)}static themeExist(t){return uX.themes.has(t)}static getDefaultTheme(){return uX.themes.get(cX)}static setCurrentTheme(t){uX.themeExist(t)&&(uX._currentThemeName=t,dX.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return uX.getTheme(uX._currentThemeName)}static getCurrentThemeName(){return uX._currentThemeName}}uX.registerTheme(cX,hX.get(cX)),hX.forEach(((t,e)=>{e!==cX&&uX.registerTheme(e,t)}));const pX=(t,e,i)=>new wr({defaultFontParams:{fontFamily:Bj,fontSize:14},getTextBounds:i?void 0:xB,specialCharSet:"-/: .,@%'\"~"+wr.ALPHABET_CHAR_SET+wr.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),gX=_B({});function fX(t,e){for(let i=0;it.key===e))}function yX(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const _X=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;s{un(t.state[e])||(t.state[e]=SX(t.state[e]))})),t}function xX(t){return un(t)?null:(Object.keys(t).forEach((e=>{un(t[e])||(t[e]=SX(t[e]))})),t)}function SX(t){return un(t)||t.angle&&(t.angle=Es(t.angle)),t}var wX;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(wX||(wX={}));class AX{static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Za,fields:to,filter:s,fold:Qa};static dataParser={csv:po,dsv:uo,tsv:go};static _layout={};static registerChart(t,e){AX._charts[t]=e}static registerSeries(t,e){AX._series[t]=e}static registerComponent(t,e){AX._components[t]=e}static registerMark(t,e){AX._marks[t]=e}static registerRegion(t,e){AX._regions[t]=e}static registerTransform(t,e){AX.transforms[t]=e}static registerLayout(t,e){AX._layout[t]=e}static createChart(t,e,i){if(!AX._charts[t])return null;return new(0,AX._charts[t])(e,i)}static createRegion(t,e,i){if(!AX._regions[t])return null;return new(0,AX._regions[t])(e,i)}static createSeries(t,e,i){if(!AX._series[t])return null;return new(0,AX._series[t])(e,i)}static createMark(t,e,i){if(!AX._marks[t])return null;const n=new(0,AX._marks[t])(e,i);return n.type===wX.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(AX._components)}static getComponentInKey(t){return AX._components[t]}static getLayout(t){return AX._layout[t]}static getSeries(t){return AX._series[t]}}const kX=(t,e,i)=>{const n=t.getRegionsInIds(Cn(e.layoutBindRegionID));return n?.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},MX=(t,e)=>t===e||!Xi(t)&&!Xi(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),CX=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},TX="monotone",EX="linearClosed";var RX;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(RX||(RX={}));var PX;function BX(t){return"bottom"===t||"top"===t}function IX(t){return"left"===t||"right"===t}function DX(t){return"z"===t}function LX(t,e){return Xh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(PX||(PX={}));const OX=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&kX(t,n,i)));return n.length?n:null},FX=t=>t.fieldX[0],zX=t=>t.fieldY[0],HX=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=jX(t,n,"x",FX);e&&o.push(e)})),a&&a.forEach((t=>{const e=jX(t,s,"y",zX);e&&o.push(e)})),o.length?o:null},jX=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return NX(t,a,n)},NX=(t,e,i)=>{const n=t.getScale();if(!n||!Wl(n.type))return null;if(Xi(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=CX(e,t,"cartesian",i??(BX(t.orient)?FX:zX));return{index:s,value:e,axis:t,data:r}},VX=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&kX(t,n,i)));return n.length?n:null},WX=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&Wl(e.type)){const h=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=Ol({x:1,y:0},c);d=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(d,r);const u=Fl(c),p=a[0]?.getScale(),g=p?.range();if((d-r?.[0])*(d-r?.[1])>0||(u-g?.[0])*(u-g?.[1])>0)return;const f=Math.abs(r[0]-r[1])/i.length/2,m=e.invert(d+f);if(Xi(m))return;let y=e.domain().findIndex((t=>t?.toString()===m.toString()));y<0&&(y=void 0);const _=CX(m,t,"polar",l);o.push({index:y,value:m,axis:t,data:_})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&Wl(e.type)){const a=t.getCenter(),h={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let c=Ol({x:1,y:0},h);c<-Math.PI/2&&(c=2*Math.PI+c);const d=Fl(h),u=r[0]?.getScale(),p=u?.range();if((c-p?.[0])*(c-p?.[1])>0||(d-i?.[0])*(d-i?.[1])>0)return;const g=e.invert(d);if(Xi(g))return;let f=e.domain().findIndex((t=>t?.toString()===g.toString()));f<0&&(f=void 0);const m=CX(g,t,"polar",l);o.push({index:f,value:g,axis:t,data:m})}})),o.length?o:null};class UX{_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=HX(this._chart,{x:t,y:e})??[],n=WX(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!Wl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=NX(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var GX;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(GX||(GX={}));const YX={[GX.dimensionHover]:class extends UX{_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:O$.chart},callback:this.onMouseMove}),qo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:O$.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),qo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!MX(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[GX.dimensionClick]:class extends UX{constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:O$.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let $X=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(YX[t]){const e=new YX[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(YX[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class XX{_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(F$.vchart,[]),this._levelNodes.set(F$.chart,[]),this._levelNodes.set(F$.model,[]),this._levelNodes.set(F$.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const KX={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class qX{globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||O$.chart),n=this.getEventListeners(e.filter?.source||O$.chart);i.get(t)||i.set(t,new XX);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||O$.chart),s=this.getEventListeners(e?.filter?.source||O$.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||O$.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||O$.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(F$.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(F$.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(F$.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(F$.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(O$.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(O$.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if($i(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&pn(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return KX[n]&&(n=KX[n]),(!t.type||n===t.type)&&(!Ki(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=Ki(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=Ki(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&Ki(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();Ki(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:pn(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:Ki(t.id)?F$.model:F$.vchart:F$.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ts(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=Qn(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=O$.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==F$.model&&i!==F$.mark||(n=e.type),e?.source&&(s=e.source),Ki(e?.id)&&(o=e?.id,i=F$.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case O$.chart:return this._viewBubbles;case O$.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case O$.chart:return this._viewListeners;case O$.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return D$.includes(t)||Object.values(uV).includes(t)||Object.values(L$).includes(t)}}function ZX(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function JX(t,e,i){t.getParser(e)||t.registerParser(e,i)}const QX=new Map;let tK;function eK(t,e,i={type:"geojson",centroid:!0}){QX.has(t)&&Uo(`map type of '${t}' already exists, will be overwritten.`),tK||(tK=new zo,JX(tK,"geojson",Bo),JX(tK,"topojson",Do),ZX(tK,"simplify",Za));const n=new jo(tK),s=xn({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),QX.set(t,n)}function iK(t,e=!1){let i=e;return t.latestData instanceof jo&&(i=!1),i?yn(t.latestData):t.latestData.slice()}const nK=(t,e)=>0===t.length?[]:1===t.length?iK(t[0],e?.deep):t.map((t=>iK(t,e?.deep)));function sK(t,e,i){ZX(e=e instanceof zo?e:t.dataSet,"copyDataView",nK);const n=new jo(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function rK(t,e,i=[]){if(t instanceof jo)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new jo(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!tn(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Go("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const aK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)}}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!tn(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&yj.getCancelAnimationFrame()(this._rafId),this._rafId=yj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===O$.chart){const n=function(n,s){const r=s?.mark?.context??{},a=Ki(r.modelId)?r.modelId:null,o=Ki(r.markId)?r.markId:null,l=Ki(r.modelUserId)?r.modelUserId:null,h=Ki(r.markUserId)?r.markUserId:null,c={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,c)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===O$.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===O$.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===O$.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(Xi(e))return;const i=e.id(),n=t.grammarType;Xi(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(Xi(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];Ki(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return Ki(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return Ko(this._option.mode)?globalThis:this.getStage()?.window}}async function gK(t){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){console.error("getCanvasDataURL",t)}return t.toDataURL()}class fK{id=Qo();static useChart(t){t.forEach((t=>AX.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>AX.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>AX.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>AX.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>AX.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){AX.registerTransform(t,e)}static registerMap(t,e,i){eK(t,e,i)}static unregisterMap(t){!function(t){QX.has(t)?QX.delete(t):Uo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,QX.get(e);var e}static hideTooltip(t=[]){dX.forEach((t=>t?.hideTooltip?.()),t)}static InstanceManager=dX;static ThemeManager=uX;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=xn(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,...a}=this._option;i&&(this._container=tn(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=uX.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new pK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,...a,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new qX(this,this._compiler),this._event=new $X(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!Ko(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(L$.initialized,{}),dX.registerInstance(this)):Go("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=ec(tn(t)?JSON.parse(t):t))}_initData(){if(Xi(this._dataSet))return void Uo("dataSet is not initialized");const t=Cn(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Go("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=Qn(((...t)=>{const{width:e,height:i}=Ha(this._container,Qj,tN),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof zo?t:new zo,JX(this._dataSet,"dataview",Lo),JX(this._dataSet,"array",e),ZX(this._dataSet,"stackSplit",aK),ZX(this._dataSet,"copyDataView",nK);for(const t in AX.transforms)ZX(this._dataSet,t,AX.transforms[t]);for(const t in AX.dataParser)JX(this._dataSet,t,AX.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return Ki(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)}))),this._event.emit(L$.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)}))),this._event.emit(L$.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),QX.clear(),tK=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,dX.unregisterInstance(this)}async updateData(t,e,i){if(Xi(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=Cn(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):en(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new jo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(Xi(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new jo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(tn(t)&&(t=JSON.parse(t)),e&&(t=xn({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=ec(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}_updateCurrentTheme(){tn(this._spec?.theme)?(this._currentTheme=xn({},uX.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=xn({},uX.getTheme(this._currentThemeName),this._spec?.theme??{})}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return uX.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===n.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(Ki(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===n.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===n.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===n.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await gK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!Ko(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(Ki(this._container))return this._container;let t;return t=tn(this._canvas)?document?.getElementById(this._canvas):this._canvas,Ki(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(un(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(Ki(n)?r=this._chart.getSeriesInUserId(n):Ki(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),tc(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||Xi(t)||un(e))return null;if(!en(t)){const{axisId:n,axisIndex:s}=e;let r;if(Ki(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):Ki(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Uo("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return Ki(n)?r=this._chart.getSeriesInUserId(n):Ki(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?tc(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Uo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(hK||(hK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(cK||(cK={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(dK||(dK={}));class mK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){Xi(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,xn({},mK.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return[...this._children]}getMarksInType(t){const e=Cn(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}class yK{event;interaction;_option;_marks=new mK;_markReverse=new mK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){un(t.stateStyle[hK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),un(t.stateStyle[hK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(GX.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=en(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(hK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(hK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(hK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(hK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(hK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(hK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class _K{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class vK extends _K{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=Q$.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Jh(Qh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=Xi(t.minHeight)?null:Zh(t.minHeight,e.height,e),this._maxHeight=Xi(t.maxHeight)?null:Zh(t.maxHeight,e.height,e),this._minWidth=Xi(t.minWidth)?null:Zh(t.minWidth,e.width,e),this._maxWidth=Xi(t.maxWidth)?null:Zh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Zh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Zh(t.height,e.height,e)},{height:9}),Xi(t.offsetX)||(this.layoutOffsetX=Zh(t.offsetX,e.width,e)),Xi(t.offsetY)||(this.layoutOffsetY=Zh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{Xi(this._spec[i])||(e[i]=Zh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};Xi(n)||(r.width-=n),Xi(s)||(r.width-=s),Xi(e)||(r.height-=e),Xi(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(Xi(n)?Xi(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,Xi(e)?Xi(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){an(t)&&(this._layoutStartPoint.x=t),an(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){an(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),an(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}_setRectInSpec(t){const e={...t};return this._layoutRectLevelMap.width<9?(Xi(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),Xi(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(Xi(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),Xi(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class bK extends _K{grammarType;id=Qo();_product;getProduct(){if(Ki(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return Ki(e)&&Ki(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){Ki(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(Ki(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(Ki);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class xK extends bK{grammarType=lK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}Ki(this._value)&&this._product.value(this._value),Ki(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class SK extends _K{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new xK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class wK extends SK{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(xn(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class AK extends wK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class kK extends vK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new mK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=Qo(),this._originalSpec=t,this._spec=ic(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new $X(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new AK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&An(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=ic(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(Xi(t)||Xi(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=xn({},e?.[Cn(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),en(t))return t.map((t=>qi(t)&&!$i(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];qi(n)&&!$i(n)&&(jh(n)?e[i]=Hh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){Ki(t)&&Ki(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!Ki(t)||!Ki(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${Jj}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=AX.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const MK={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",rectRound:"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"},CK={symbol:function(t,e){return"shape"===t?MK[e]??e:e}};const TK={};Object.values(hK).forEach((t=>{TK[t]=!0}));const EK={[hK.STATE_HOVER]:hK.STATE_HOVER_REVERSE,[hK.STATE_SELECTED]:hK.STATE_SELECTED_REVERSE,[hK.STATE_DIMENSION_HOVER]:hK.STATE_DIMENSION_HOVER_REVERSE};function RK(t){return EK[t]}class PK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!un(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=RK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=RK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=RK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=RK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class BK extends wK{id=Qo();stateKeyToSignalName=t=>`${Jj}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===oK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===oK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===oK.enter?oK.appear:oK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===oK.enter?oK.appear:oK.none}}}}class IK extends kK{static type="region";modelType="region";type=IK.type;_series=[];layoutType="region";layoutZIndex=J$.Region;animate;interaction=new PK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new BK({getCompiler:e.getCompiler})),Ki(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:wX.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",W$.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",W$.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:wX.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:wX.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",W$.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(J$.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",W$.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",W$.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",W$.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||Cn(t.userId).includes(e.userId))&&(!Ki(t.specIndex)||!e.getSpecIndex||Cn(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(L$.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new yK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in cK)un(t.stateStyle[cK[e]])||this.interaction.registerMark(cK[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class DK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient&&(this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const LK=[wX.line,wX.area,"trail"];function OK(t){return LK.includes(t)}class FK extends wK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];Ki(n.domain)&&(s.domain=n.domain),Ki(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=Yi(OK)?n:!t.mark||OK(t.mark.markType);let s=!1,r=!1;if(Ki(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!TK[t])).map((t=>[t,10])),n=!t.mark||OK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(en(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Jj)));n=t.datums.some((t=>i&&en(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(qi(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Jj)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(Nl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class zK extends bK{grammarType=lK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();Xi(t)||(Xi(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class HK extends zK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return Ki(t)?t:`${Jj}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;Xi(t)||Ki(this.getProduct())||this._initProduct(t)}}class jK extends bK{grammarType=lK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=J$.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){Ki(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){Xi(this._data)&&this.initMarkData({...this._option,mark:this}),Ki(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new FK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new $X(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new HK(t)}stateKeyToSignalName(t){return`${Jj}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(Ki(e)&&this.removeProduct());if(Ki(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),Xi(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(Xi(this._data))return;this._data.compile();const t=this._data.getProduct();Ki(this._product)&&Ki(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[hK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!$i(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(uV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===oK.appear&&this.runAnimationByState(oK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),CK[a]?CK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class NK extends jK{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(Ki(t.id)&&(this._userId=t.id),Yi(t.interactive)&&(this._interactive=t.interactive),Ki(t.zIndex)&&this.setZIndex(t.zIndex),Yi(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(rn(t))return kl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(kl)),t}return"function"==typeof t?(e,i,n,s)=>kl(t(e,i,n,s)):t}isUserLevel(t){return[W$.User_Mark,W$.User_Series,W$.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(Xi(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];Xi(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;Ki(r)&&r<=n&&xn(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Vl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return tn(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=Uh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;return s=this.stateStyle[i]?.[t]?this._computeStateAttribute(this.stateStyle[i][t],t,e,i,n):this._computeStateAttribute(this.stateStyle.normal[t],t,e,i,n),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,s):s}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):tX.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):Vl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",W$.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=$i(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,W$.User_Mark,e)}else this.setStyle(i,t,W$.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let l=s,h=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(l=t),h||(h=e)}const c=Fh(Oh(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),d={},u={...eX[n],...a};return Object.keys(u).forEach((t=>{const n=u[t];"stops"===t?d.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??l?.scale(e[h]);return $i(s)&&(a=s(e,this._attributeContext,i,o)),Ki(n)&&(a=Wo.SetOpacity(a,n)),{offset:$i(r)?r(e,this._attributeContext,i,o):r,color:a||c[0]}})):$i(n)?d[t]=n(e,this._attributeContext,i,o):d[t]=n})),d.gradient=n,d}_computeThresholdAttr(t){return(new Ph).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class VK extends NK{static type=wX.group;type=VK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Uo("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Uo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class WK extends NK{static type=wX.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(nV.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}fK.useMark([WK,VK]),AX.registerRegion("region",IK),AX.registerLayout("base",DK);var UK,GK,YK;!function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(UK||(UK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(GK||(GK={}));class $K{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Uh("colorOrdinal"):Uh(t.type)),e?(en(t.range)&&e.range(t.range),en(t.domain)&&(el(t.domain)||e.domain(t.domain)),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(An(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!An(n.range,s.range())&&(s.range(n.range),e.reRender=!0),el(n.domain)?e.reRender=!0:An(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{el(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{fX(e,[{key:t,operations:Nl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&fX(e,[{key:i.field,operations:Nl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!el(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=Nl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{Nl(e.type)?(Xi(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),Xi(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;Nl(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!Xi(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(Nl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(Nl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));Nl(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(Xi(t.field)||!Xi(t.changeDomain)&&"none"!==t.changeDomain&&!Xi(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class XK{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(L$.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][G$]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[G$],s>=0?(t[U$]=e,e+=t[G$],t[G$]=e):(t[U$]=i,i+=t[G$],t[G$]=i)})),t.values.forEach((t=>{s=t[G$];const r=s>=0?e:i;n=s>=0?1:-1,t[Y$]=Math.min(1,t[U$]/r)*n,t[$$]=Math.min(1,t[G$]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[G$]=function(t){if(an(t))return t;const e=+t;return an(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class KK extends _K{type="chart";id=Qo();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:Qj,height:tN};getLayoutRect(){return this._layoutRect}_viewRect={width:Qj,height:tN};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:Qj,y2:tN};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=Qh(t.padding??this._theme?.padding),this._event=new $X(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new XK(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),fn(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=AX.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=rK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),Ki(t.regionId)?i=this.getRegionsInUserId(t.regionId):Ki(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=AX.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&Cn(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=AX.getComponents();let i,s;const r=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(AX.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(L$.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(L$.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Cn(t).some((t=>Ki(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof kK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof NK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof NK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(Ki(t)&&Ki(e))this._canvasRect={width:t,height:e};else{let i=Qj,n=tN;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=Ha(this._option.container,Qj,tN);i=t,n=e}else if(r&&Ko(this._option.mode)){let t;t=tn(r)?document?.getElementById(r):r;const{width:e,height:s}=Ha(t,Qj,tN);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;en(t)?e.range=t.map((t=>Hh(t,this._theme?.colorScheme))):(e.type=t.type,t.domain&&(e.domain=t.domain),e.range=t.range)}return e.range?.length||(e.range=Oh(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new $K(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Oh(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&Cn(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};en(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Jh(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(un(t[n]))continue;const s=t[n];let r={stateValue:n};r=$i(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(hK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(hK.STATE_HOVER,!0,t,e,i)}initEvent(){[L$.dataZoomChange,L$.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(uV.AFTER_MARK_RENDER_END,e)};this._event.on(uV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?Cn(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||$i(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===GX.dimensionHover||s===GX.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===n.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===n.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class qK extends KK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function ZK(t){t.crosshair=Cn(t.crosshair||{}).map((e=>xn({[t.direction===$h.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(YK||(YK={}));const JK=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:h}=e,c=[],{dimensionValues:d,dimensionData:u}=h().latestData,p=Array.from(d[i]);let g={start:0,end:0,lastIndex:null};return p.forEach(((t,e)=>{const i={start:g.end,end:g.end,lastIndex:g.lastIndex,lastEnd:g.end,index:t,isTotal:!1};u[t].forEach((t=>{let h=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(h=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,g);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!Xi(t[a.collectCountField])){const i=c.length-+t[a.collectCountField],n=c.length-1;i<0?console.warn("total.collectCountField error"):e=c[i].start,n<0?console.warn("total.collectCountField error"):o=c[n].end}else a.startField&&!Xi(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!Xi(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===p.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,h=!0);h||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=h,(Xi(o)||o===z$)&&(t[z$]=h?l.total:+t[n]>=0?l.increase:l.decrease)})),g={...i,lastIndex:t},c.push(i)})),c},QK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},tq=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:eq(t.map((t=>t.latestData)).flat(),e.fields,i)}};function eq(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>eq(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class iq{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new jo(e instanceof zo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),ZX(e,"dimensionTree",tq),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const nq=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class rq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new mK;_markReverse=new mK;constructor(t,e){this._spec=t,this._option=e,this.event=new $X(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(hK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(hK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(Cn(i).forEach((e=>{t.on(e,{level:F$.chart},this.onHover)})),n&&"none"!==n&&Cn(n).forEach((e=>{t.on(e,{level:F$.vchart,source:O$.chart},this.onUnHover)}))),s&&(Cn(r).forEach((e=>{t.on(e,{level:F$.mark},this.onSelect)})),a&&"none"!==a&&Cn(a).forEach((e=>{t.on(e,{level:F$.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=sq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;Yi(i)?this._hover.enable=i:qi(i)&&(this._hover.enable=!0,this._hover=xn(this._hover,i));const n=this._spec.select;Yi(n)?this._select.enable=n:qi(n)&&(this._select.enable=!0,this._select=xn(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,hK.STATE_HOVER)||this.interaction.getEventElement(hK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,hK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(hK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(hK.STATE_HOVER,t.item),this.interaction.reverseEventElement(hK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(hK.STATE_HOVER);this.interaction.clearEventElement(hK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(hK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,hK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(hK.STATE_SELECTED);this.interaction.clearEventElement(hK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(hK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(hK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(hK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(hK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(hK.STATE_SELECTED);const e=this.interaction.getEventElementData(hK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,hK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class aq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const oq=(t,e)=>Ki(e)?t.map((t=>e[t])):void 0,lq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),hq=t=>!Xi(t)&&(en(t)?t.length>0&&t.every(Ki):Object.keys(t).length>0);function cq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(Ki(s.regionId)?[s.regionId]:void 0,Ki(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=Ki(s)?t[s]:void 0,a=Ki(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=oq(i,t);let h=oq(n,t);const c=hq(h),d=!c&&Ki(s)&&Xi(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,u=i.map(((t,e)=>[t,e])).filter((([,t])=>Xi(l?.[t])));let p=[l??[]];u.length>0&&u.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];p.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),p=s})),p.forEach((l=>{if(d){const r=t.getViewData()?.latestData.filter(lq(i,l));a.forEach((a=>{const d=r.find((t=>t[s]===a));if(h=oq(n,d),!hq(h))return;const u=t.dataToPosition(d);Xi(u)||isNaN(u.x)||isNaN(u.y)||o.push({pos:u,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===GK.pie){const t=e,a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToCentralPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}else{const t=e;if(d){const d=t.getViewData()?.latestData.filter(lq(i,l)),u=d.find((t=>t[s]===r));a.forEach((r=>{if(h=oq(n,u),!hq(h))return;const a=t.dataToPosition(u);Xi(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),h=r.getLayoutStartPoint(),c=r.getLayoutRect(),d=n.globalInstance.getContainer(),u={x:0,y:0,...d?ja(d):{}},p=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>lq(e,i)(t)&&lq(n,s)(t)&&(Xi(r)||lq([r],[a])(t))));return o},g=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),c.width),y:Math.min(Math.max(t.y,0),c.height)}))(t),i=s.x??h.x+e.x,n=s.y??h.y+e.y;return{canvasX:i,canvasY:n,clientX:u.x+i,clientY:u.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>p(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:O$.chart,event:g({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return fK.globalConfig.uniqueTooltip&&fK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...p(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:O$.chart,event:g(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return fK.globalConfig.uniqueTooltip&&fK.hideTooltip(a.id),l}return"none"}const dq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return Ki(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function uq(t){return Xi(t.mark)&&Xi(t.model)&&Xi(t.datum)}class pq extends aq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];Ki(i)&&(e[t]={...i,title:Ki(i.title)?$i(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:Ki(i.content)?$i(i.content)?i.content:Cn(i.content).map((t=>$i(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=dq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:Ki(e)?Cn(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of Cn(e)){const e=this.series.getSeriesStyle(t)?.(i);if(Ki(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return Ki(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const gq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},fq={min:t=>t===gq.min()?0:t,max:t=>t===gq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===gq.min()?0:t,"array-max":t=>t===gq.max()?0:t};const mq={min:function(t,e){return tl(e)?Math.min(t,e):t},max:function(t,e){return tl(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>tl(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>tl(t)));return 0===i.length?t:Math.max(t,...i)}},yq=(t,e)=>{const i={};let n=e.fields;if($i(n)&&(n=n()),!n?.length||!t?.length)return i;n=fX([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!Xi(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=gq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=mq[n](i[t.key][n],s)})),i[t.key][n]=fq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},_q=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>tl(t[s])));else if("zero"===n)return t.forEach((t=>{tl(t[s])||(t[s]=0)})),t;return t};class vq extends zK{_compileProduct(){const t=this._data?.latestData;Xi(t)||Ki(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const bq=`${Jj}_HIERARCHY_DEPTH`,xq=`${Jj}_HIERARCHY_ROOT`,Sq=`${Jj}_HIERARCHY_ROOT_INDEX`,wq=()=>({keyMap:new Map});function Aq(t,e,i){t&&(this._seriesField||(t[N$]=this.getSeriesKeys()[0]),t[H$]=e,t[j$]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function kq(t,e,i,n=0,s,r){void 0===r&&(r=e),Aq.bind(this)(t,e,i),t[bq]=n,t[xq]=s||t[this.getCategoryField()],t[Sq]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>kq.bind(this)(e,n,i,t[bq]+1,t[xq],r)))}class Mq extends kK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[UK.label]:{name:UK.label,type:wX.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){Ki(t)&&(this._seriesField=t,this.getMarksInType([wX.line,wX.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(L$.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&Ki(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(L$.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(Xi(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),Yi(this._spec.stack)&&(this._stack=this._spec.stack),Yi(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),Yi(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),Ki(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=sK(this._rawData,this._dataSet,{name:`${Jj}_series_${this.id}_viewDataFilter`});const t=sK(this._viewDataFilter,this._dataSet,{name:`${Jj}_series_${this.id}_viewData`});this._data=new vq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(ZX(this._option.dataSet,"invalidTravel",_q),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new iq(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${Jj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${Jj}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){ZX(this._dataSet,"dimensionStatistics",yq);const n=new jo(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=fX(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&fX(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${Jj}_series_${this.id}_viewStackData`;this._viewStackData=new jo(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(Xi(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(tn(t))return e[t];if(en(t)&&t.every((t=>tn(t))))return t.map((t=>e[t])).join("-");if($i(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(ZX(this._rawData.dataSet,"addVChartProperty",nq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(L$.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(L$.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(L$.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(L$.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(L$.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||Xi(e)?[]:tn(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:wX.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Jj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Jj}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||Xi(t.dataId)&&Xi(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new rq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??N$;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:V$,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,V$)}))}afterInitMark(){this.event.emit(L$.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",W$.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new pq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??N$,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Oh(this._option.getTheme().colorScheme,this.type);return(new Vh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??N$}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=xn({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:o,dataProductId:l,parent:h,isSeriesMark:c,dataStatistics:d,depend:u,label:p,progressive:g,support3d:f=this._spec.support3d||!!this._spec.zField,morph:m=!1}=e,y=super._createMark(t,{key:i??this._getDataIdKey(),support3d:f,dataStatistics:d??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(Ki(y)){this._marks.addMark(y),c&&(this._seriesMark=y),Xi(h)?this._rootMark?.addMark(y):!1!==h&&h.addMark(y),Xi(o)?(y.setDataView(this.getViewData(),this.getViewDataProductId()),y.setSkipBeforeLayouted(!0)):!1!==o&&y.setDataView(o,l),Yi(s)&&y.setSkipBeforeLayouted(s),Ki(u)&&y.setDepend(...Cn(u)),Ki(p)&&y.setLabelSpec(p);const t=this.getSpec()||{};y.setMorph(m),y.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),y.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),Xi(g)||y.setProgressiveConfig(g),Xi(n)||y.setGroupKey(n),this.initMarkStyleWithSpec(y,xn({},r,a||t[y.name]))}return y}_getDataIdKey(){return super._getDataIdKey()??j$}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==G$&&t!==$$&&t!==U$&&t!==Y$||(t=this.getStackValueField()),yX(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=AX.getSeries(this.type);return Object.values(t.mark??{})}return t}}class Cq extends Mq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Cn(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Cn(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Cn(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=$h.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&this._fieldX.forEach((e=>{const i={key:e,operations:[]};Nl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&this._fieldY.forEach((e=>{const i={key:e,operations:[]};Nl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};Nl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===$h.vertical?Cn(this._spec.yField)[0]:Cn(this._spec.xField)[0]}setValueFieldToStack(){this.direction===$h.vertical?(this.setFieldY(G$),this.setFieldY2(U$)):(this.setFieldX(G$),this.setFieldX2(U$))}setValueFieldToPercent(){this.direction===$h.vertical?(this.setFieldY($$),this.setFieldY2(Y$)):(this.setFieldX($$),this.setFieldX2(Y$))}setValueFieldToStackOffsetSilhouette(){this.direction===$h.vertical?(this.setFieldY(K$),this.setFieldY2(X$)):(this.setFieldX(K$),this.setFieldX2(X$))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Vo(t.xField,i)&&Vo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),Ki(this._spec.direction)&&(this._direction=this._spec.direction),this._direction===$h.vertical?(this.setFieldY2("y1"),this.setFieldX2(this._spec?.x2Field)):(this.setFieldX2("x1"),this.setFieldY2(this._spec?.y2Field)),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(Cn(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(Cn(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[0]:Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===$h.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===$h.vertical?Cn(this._spec.yField??this.fieldY):Cn(this._spec.xField??this.fieldX)}}const Tq=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};const Eq={type:"clipIn"},Rq={type:"fadeIn"};function Pq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===$h.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===$h.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Rq;default:return Eq}}function Bq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=i?.[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const Iq=(t,e=!0)=>({type:t.direction===$h.horizontal?"growWidthIn":"growHeightIn",options:Bq(t,e)}),Dq=(t,e=!0)=>({type:t.direction===$h.horizontal?"growWidthOut":"growHeightOut",options:Bq(t,e)}),Lq={type:"fadeIn"},Oq={type:"growCenterIn"};function Fq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Lq;case"scaleIn":return Oq;default:return Iq(t)}}const zq={type:"clipIn"},Hq={type:"fadeIn"};function jq(t,e){switch(e){case"grow":return(t=>({type:t.direction===$h.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===$h.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Hq;default:return zq}}function Nq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Vq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Nq(t,!0,oK.appear)}),Wq={type:"fadeIn"},Uq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Nq(t,!0,oK.enter)}),Gq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Nq(t,!0,oK.exit)}),Yq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:Nq(t,!0,oK.exit)});function $q(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Wq;case"growRadius":return Vq({...t,growField:"radius"});default:return Vq({...t,growField:"angle"})}}const Xq={type:"fadeIn"};function Kq(t,e){return"fadeIn"===e?Xq:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function qq(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const Zq=t=>({type:t.direction===$h.horizontal?"growWidthOut":"growHeightOut",options:qq(t)}),Jq={type:"fadeIn"};function Qq(t,e){return!1===e?{}:"fadeIn"===e?Jq:(t=>({type:t.direction===$h.horizontal?"growWidthIn":"growHeightIn",options:qq(t)}))(t)}const tZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function eZ(t,e,i){return"fadeIn"===e?tZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function iZ(t,e,i){return"fadeIn"===e?tZ(i):((t,e)=>{const i=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const nZ=(t,e)=>({custom:LC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class sZ extends dC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;$i(r)&&$i(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);an(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);an(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class rZ extends IC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new As(d,u,p,g);return f.defined=e.defined,f}}const aZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},oZ={type:"fadeIn"},lZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),hZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),cZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function dZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return oZ;case"growAngle":return aZ({...t,growField:"angle"});default:return aZ({...t,growField:"radius"})}}const uZ={type:"fadeIn"},pZ={type:"growCenterIn"};function gZ(t,e){switch(e){case"fadeIn":return uZ;case"scaleIn":return pZ;default:return Iq(t,!1)}}const fZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},mZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),yZ={type:"fadeIn"},_Z=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vZ(t,e){return"fadeIn"===e?yZ:mZ(t)}const bZ=t=>({custom:FC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),xZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},SZ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},wZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===iV.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},AZ=(t,e,i)=>{if(un(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},kZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=AZ(r,n,s);return SZ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=AZ(r,n,s);return SZ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),MZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},CZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=MZ(r);return SZ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=MZ(r);return SZ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),TZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},EZ={type:"fadeIn"};function RZ(t){return!1===t?{}:EZ}const PZ={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},BZ={bar:(t,e)=>({appear:Fq(t,e),enter:Iq(t,!1),exit:Dq(t,!1),disappear:Dq(t)}),bar3d:(t,e)=>({appear:Fq(t,e),enter:Iq(t,!1),exit:Dq(t,!1),disappear:Dq(t)}),line:(t,e)=>({appear:jq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:IC,duration:PZ.update.duration,easing:PZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:Pq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:$q(t,e),enter:Uq(t),exit:Gq(t),disappear:Yq(t)}),pie3d:(t,e)=>({appear:$q(t,e),enter:Uq(t),exit:Gq(t),disappear:Yq(t)}),rose:(t,e)=>({appear:dZ(t,e),enter:lZ(t),exit:hZ(t),disappear:cZ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:eZ(t,e,"in"),enter:eZ(t,e,"in"),exit:eZ(t,e,"out"),disappear:"clipIn"===e?void 0:eZ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:rZ,customParameters:t,duration:PZ.update.duration,easing:PZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:iZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:iZ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:sZ,customParameters:t,duration:PZ.update.duration,easing:PZ.update.easing}]}),radarGroup:(t,e)=>({appear:nZ(t,"in"),disappear:nZ(t,"out")}),circularProgress:(t,e)=>({appear:Kq(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:fZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:Qq(t,e),enter:{type:"grow"},disappear:Zq(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:OC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:OC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:bZ(t)}),rangeColumn:(t,e)=>({appear:vZ(t,e),enter:mZ(t),exit:_Z(t),disappear:_Z(t)}),waterfall:(t,e)=>({appear:gZ(t,e),enter:Iq(t,!1),exit:Dq(t,!1),disappear:Dq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:xZ(0,e),enter:kZ(t),exit:CZ(t),disappear:CZ(t)}),circlePacking:(t,e)=>({appear:TZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:RZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:mG},update:{custom:fG},exit:{custom:zC}})},IZ=["appear","enter","update","exit","disappear","normal"];function DZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=$i(n)?n(t,s,r):an(n)?n:0;let l=$i(i)?i(t,s,r):i;return!1===l?0:(l=!0===l?0:l,a*(o+l))},delete t.oneByOne,t}function FZ(t){return t?.[H$]}function zZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function HZ(t){return!function(t){return Ki(t.timeSlices)}(t)&&Ki(t.channel)}class jZ extends NK{static type=wX.rect;type=jZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class NZ extends NK{static type=wX.text;type=NZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}fK.useMark([jZ,NZ]);class VZ extends Cq{static type=GK.bar;type=GK.bar;_barMarkName=UK.bar;_barMarkType=wX.rect;static mark={...Mq.mark,[UK.bar]:{name:UK.bar,type:wX.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...VZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:zZ(this._spec.animation,this._spec.morph,LZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:xn({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===$h.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Gh(this.dataToPositionX(e),t),x1:e=>Gh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Nl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",W$.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Nl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Gh(this.dataToPositionY(t),e),y1:t=>Gh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",W$.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Gh(this.dataToPositionX(e),t),x1:e=>Gh(this.dataToPositionX1(e),t),y:t=>Gh(this.dataToPositionY(t),e),y1:t=>Gh(this.dataToPositionY1(t),e)},"normal",W$.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(DZ(BZ.bar(t,e),LZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Tq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Tq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Tq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class WZ extends NK{static type=wX.rule;type=WZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}fK.useMark([WZ]);class UZ extends VZ{static type=GK.waterfall;type=GK.waterfall;static mark={...VZ.mark,[UK.leaderLine]:{name:UK.leaderLine,type:wX.rule},[UK.stackLabel]:{name:UK.stackLabel,type:wX.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],Xi(this._seriesField)&&(this._seriesField=z$)}getSeriesKeys(){return this._seriesField===z$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),ZX(this._dataSet,"waterfallFillTotal",QK),ZX(this._dataSet,"waterfall",JK),(Xi(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=sK(this.getViewData(),this._dataSet,{name:`${Jj}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new vq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:U$,endAs:G$,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(DZ(BZ.waterfall(t,e),LZ(UK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec),{dataIndex:i}))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(UZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(UZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n}=this._xAxisHelper;return this._direction===$h.vertical?n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("width",t)*i:Gh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n}=this._yAxisHelper;return this._direction===$h.vertical?Gh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("height",t)*i}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===$h.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!Xi(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",W$.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!Xi(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",W$.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===$h.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const GZ=`${Jj}_BOX_PLOT_OUTLIER_VALUE`;var YZ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(YZ||(YZ={}));const $Z=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];en(e)||(e=[e]),i.push(...e.map((e=>{const i={[GZ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class XZ extends pq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(YZ.OUTLIER),value:this.getContentValue(YZ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(YZ.MAX),value:this.getContentValue(YZ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.Q3),value:this.getContentValue(YZ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.MEDIAN),value:this.getContentValue(YZ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.Q1),value:this.getContentValue(YZ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.MIN),value:this.getContentValue(YZ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.SERIES_FIELD),value:this.getContentValue(YZ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===YZ.OUTLIER)return this.series.getOutliersField();if(t===YZ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case YZ.MIN:return this.series.getMinField();case YZ.MAX:return this.series.getMaxField();case YZ.MEDIAN:return this.series.getMedianField();case YZ.Q1:return this.series.getQ1Field();case YZ.Q3:return this.series.getQ3Field();case YZ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===YZ.OUTLIER)return e[GZ];if(t===YZ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case YZ.MIN:return e[this.series.getMinField()];case YZ.MAX:return e[this.series.getMaxField()];case YZ.MEDIAN:return e[this.series.getMedianField()];case YZ.Q1:return e[this.series.getQ1Field()];case YZ.Q3:return e[this.series.getQ3Field()];case YZ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>Ki(t[GZ])}class KZ extends NK{static type=wX.boxPlot;type=KZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(ZN("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(rW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),QV("barBoxplotScaleIn",tW(sW)),QV("barBoxplotScaleOut",eW(sW))):(ZN("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(nW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),QV("boxplotScaleIn",tW(iW)),QV("boxplotScaleOut",eW(iW)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class qZ extends NK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:RX.circle,fill:void 0,lineWidth:0}}}class ZZ extends qZ{static type=wX.symbol;type=ZZ.type}fK.useMark([KZ,ZZ]);class JZ extends Cq{static type=GK.boxPlot;type=GK.boxPlot;static mark={...Mq.mark,[UK.boxPlot]:{name:UK.boxPlot,type:wX.boxPlot},[UK.outlier]:{name:UK.outlier,type:wX.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(JZ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(JZ.mark.outlier,{progressive:t,key:H$,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===$h.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,hK.STATE_NORMAL,W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:rn(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},hK.STATE_NORMAL,W$.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===$h.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Gh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Gh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Gh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Gh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Gh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},hK.STATE_NORMAL,W$.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===$h.vertical?{x:this.dataToPositionX.bind(this),y:e=>Gh(t(this.getDatumPositionValues(e,GZ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Gh(t(this.getDatumPositionValues(e,GZ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,hK.STATE_NORMAL,W$.Series)}}initData(){if(super.initData(),!this._data)return;ZX(this._dataSet,"foldOutlierData",$Z),ZX(this._dataSet,"addVChartProperty",nq);const t=new jo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Jj}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===$h.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1),this._outlierDataView=new vq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===$h.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===$h.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===$h.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(BZ.boxPlot()),i=this._initAnimationSpec(LZ(UK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(DZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(DZ(BZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new XZ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class QZ{setSeriesField(t){Ki(t)&&(this._seriesField=t,this.getMarksInType([wX.line,wX.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(tJ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",W$.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:EX},"normal",W$.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===TX?t===$h.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",W$.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",W$.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(tJ.point,{morph:zZ(this._spec.animation,this._spec.morph,LZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:xn({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",W$.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?tl(t[this.getStackValueField()]):"link"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?tl(t[this.getStackValueField()]):"link"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series))}}const tJ={[UK.point]:{name:UK.point,type:wX.symbol},[UK.line]:{name:UK.line,type:wX.line}};class eJ extends NK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(Xi(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(Xi(h)||s.includes(l))return;a&&r.includes(l)&&(Vl(h?.type)||h?.scale||$i(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class iJ extends eJ{static type=wX.line;type=iJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===GK.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}fK.useMark([iJ,ZZ,NZ]);class nJ extends Cq{static type=GK.line;type=GK.line;_invalidType="break";static mark={...Mq.mark,...tJ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(DZ(BZ.line(t,e),LZ(UK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(DZ(BZ.symbol(),LZ(UK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}Mn(nJ,QZ);class sJ extends NK{static type=wX.rect3d;type=sJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}fK.useMark([sJ,NZ]);class rJ extends VZ{static type=GK.bar3d;type=GK.bar3d;static mark={...Mq.mark,[UK.bar3d]:{name:UK.bar3d,type:wX.rect3d}};_barMarkName=UK.bar3d;_barMarkType=wX.rect3d}function aJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===$h.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if(l()===$h.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=s(t),o=r(t);if(e===$h.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===$h.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",W$.Series)}class oJ extends pq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===$h.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class lJ extends VZ{static type=GK.rangeColumn;type=GK.rangeColumn;_barMarkType=wX.rect;_barName=GK.bar;static mark={...VZ.mark,[UK.minLabel]:{name:UK.minLabel,type:wX.text},[UK.maxLabel]:{name:UK.maxLabel,type:wX.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(lJ.mark.bar,{morph:zZ(this._spec.animation,this._spec.morph,LZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===nX.bothEnd?void 0:xn({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===nX.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(lJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(lJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===$h.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});aJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===$h.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});aJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===$h.horizontal?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===$h.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===$h.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Gh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Gh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Nl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",W$.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Nl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Gh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Gh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",W$.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(DZ(BZ.rangeColumn({direction:this.direction},e),LZ(UK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new oJ(this)}}fK.useMark([sJ]);class hJ extends lJ{static type=GK.rangeColumn3d;type=GK.rangeColumn3d;_barMarkType=wX.rect3d;_barName=GK.bar3d}class cJ extends eJ{static type=wX.area;type=cJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}fK.useMark([iJ,cJ,NZ,ZZ]);class dJ extends Cq{static type=GK.area;type=GK.area;static mark={...Mq.mark,...tJ,[UK.area]:{name:UK.area,type:wX.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(dJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===TX?this._direction===$h.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===$h.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Gh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",W$.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Gh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",W$.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(i,{curveType:e},"normal",W$.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(DZ(BZ.line(t,e),LZ(UK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(DZ(BZ.area(t,e),LZ(UK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(DZ(BZ.symbol(),LZ(UK.point,this._spec)))}}Mn(dJ,QZ);class uJ extends pq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===$h.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class pJ extends dJ{static type=GK.rangeArea;type=GK.rangeArea;static mark={...dJ.mark};initMark(){this._areaMark=this._createMark(pJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===TX?this._direction===$h.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===$h.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this)},"normal",W$.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",W$.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(i,{curveType:e},"normal",W$.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new uJ(this)}}me();const gJ={},fJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function mJ(t,e){t&&tn(t)||hl("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(gJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=me().projection(n),n.copy=n.copy||function(){const t=i();return fJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),gJ[i]||null}const yJ={albers:De,albersusa:function(){var t,e,i,n,s,r,a=De(),l=Ie().rotate([154,0]).center([-2,58.5]).parallels([55,65]),h=Ie().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){r=[t,e]}};function d(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(n.point(e,a),r)||(s.point(e,a),r)}function u(){return t=e=null,d}return d.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?l:s>=.166&&s<.234&&n>=-.214&&n<-.115?h:a).invert(t)},d.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),l.stream(i),h.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(yJ).forEach((t=>{mJ(t,yJ[t])}));const _J="Feature",vJ="FeatureCollection";function bJ(t){const e=Cn(t);return 1===e.length?e[0]:{type:vJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===vJ?t.features:Cn(t).filter((t=>!Xi(t))).map((t=>t.type===_J?t:{type:_J,geometry:t}))}(e))),[])}}const xJ=fJ.concat(["pointRadius","fit","extent","size"]);function SJ(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{xJ.includes(n)&&(i=i.concat(zN(t[n],e)))})),i):i}const wJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(Xi(i))for(let i=0;i(l(t),t)))};class AJ extends Mq{type=GK.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(Xi(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(Xi(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return Xi(r)||isNaN(r.x)||isNaN(r.y)?null:r}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Jj}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const kJ=(t,e)=>(t.features&&t.features.forEach((t=>{e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class MJ extends pq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class CJ extends NK{static type=wX.path;type=CJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var TJ,EJ,RJ;fK.useMark([CJ,NZ]),TJ="projection",EJ=class extends RW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return Xi(this.spec.pointRadius)||this.detach(zN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(zN(t,this.view)),this.commit(),this}size(t){return Xi(this.spec.size)||this.detach(zN(this.spec.size,this.view)),this.spec.size=t,this.attach(zN(t,this.view)),this.commit(),this}extent(t){return Xi(this.spec.extent)||this.detach(zN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(zN(t,this.view)),this.commit(),this}fit(t){return Xi(this.spec.fit)||this.detach(zN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(zN(t,this.view)),this.commit(),this}configure(t){return this.detach(SJ(this.spec,this.view)),Xi(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(SJ(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=mJ((t||"mercator").toLowerCase());return e||hl("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),fJ.forEach((t=>{var i,n,s;Xi(this.spec[t])||(i=this.projection,n=t,s=jN(this.spec[t],e,mJ),$i(i[n])&&i[n](s))})),Xi(this.spec.pointRadius)||this.projection.path.pointRadius(jN(this.spec.pointRadius,e,mJ)),!(Xi(this.spec.fit)||Xi(this.spec.extent)&&Xi(this.spec.size))){const t=bJ(jN(this.spec.fit,e,mJ));this.spec.extent?this.projection.fitExtent(jN(this.spec.extent,e,mJ),t):this.spec.size&&this.projection.fitSize(jN(this.spec.size,e,mJ),t)}return this.projection}output(){return this.projection}},RJ="projections",c$[TJ]={grammarClass:EJ,specKey:null!=RJ?RJ:TJ};class PJ extends AJ{static type=GK.map;type=GK.map;static mark={...Mq.mark,[UK.area]:{name:UK.area,type:wX.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),!this.map)throw new Error(`map type '${this.map}' is not specified !`);if(!QX.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),ZX(this._dataSet,"copyDataView",nK),ZX(this._dataSet,"map",kJ),ZX(this._dataSet,"lookup",wJ);const t=QX.get(this.map);if(!t)throw Error("no valid map data found!");const e=new jo(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??N$,j$],as:[this.nameField,this.valueField,this._seriesField??N$,j$]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new vq(this._option,e)}initMark(){this._pathMark=this._createMark(PJ.mark.area,{morph:zZ(this._spec.animation,this._spec.morph,LZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(PJ.mark.label,{skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>Ki(t[this._seriesField??N$])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??N$]):this._theme?.defaultFillColor,path:this.getPath.bind(this)},"normal",W$.Series),this.setMarkStyle(t,{smoothScale:!0},"normal",W$.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(DZ(BZ.path(),LZ(UK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec)))}initTooltip(){this._tooltipHelper=new MJ(this)}getPath(t){const e=this._areaCache.get(t?.properties?.[this._nameProperty]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t?.properties?.[this._nameProperty],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===wX.path?s.forEach((t=>{t.getGraphicItem().scale(e,e,i)})):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===wX.path?n.forEach((t=>{t.getGraphicItem().translate(e[0],e[1])})):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return an(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]??t.properties?.[this.nameField]??""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return t=>t?.properties?.[this._nameProperty]}}class BJ extends Mq{coordinate="polar";_outerRadius=TN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=Ki(t)?Cn(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=Ki(t)?Cn(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Cn(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(Xi(t)||Xi(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Cn(t)),n=this.radiusAxisHelper.dataToPosition(Cn(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};Nl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};Nl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),Ki(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),Ki(this._spec.radius)&&(this._outerRadius=this._spec.radius),Ki(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Vo(t.angleField,i)&&Vo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const IJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=Al(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},DJ=(t,e)=>{const i=t[0].latestData;return new OJ(e.series,i).updateLabels()};class LJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class OJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=pX(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[sN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:h}=n;if("inside"!==t?.position){const t=Tl(e.x,e.y,this._series.computeDatumRadius(s,hK.STATE_HOVER),n.middleAngle),i=Tl(e.x,e.y,this._series.computeDatumRadius(s,hK.STATE_SELECTED),n.middleAngle),a=Tl(e.x,e.y,this._series.computeDatumRadius(s,hK.STATE_NORMAL),n.middleAngle);s[pN]=a.x,s[gN]=a.y,s[dN]=t.x,s[uN]=t.y,s[vN]=i.x,s[bN]=i.y,s[fN]=l.x,s[mN]=l.y,s[yN]=h.x,s[_N]=h.y,s[aN]=r.y-o.height/2}else s[aN]=r.y;return s[iN]=this._computeAlign(n),s[eN]=Math.max(a,0),s[sN]=n.labelVisible&&!Xi(n.labelText),s[rN]=r.x,s[nN]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=Tl(e.x,e.y,f,t.middleAngle),t.labelLimit=p,Gn(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=El(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=El(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(Yn(t.pointB.x,n+r)||Gn(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?wl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?Xi(i)||"auto"===i?"edge"===n?El(t.quadrant)?"left":"right":El(t.quadrant)?"right":"left":i:Xi(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=Xi(n)||Xi(t[n])||Xi(t[s]);return $i(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class FJ extends NK{type=zJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+Cl({angle:e[xN],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class zJ extends FJ{static type=wX.arc;type=zJ.type}fK.useMark([CJ,NZ,zJ]);class HJ extends BJ{_pieMarkName=UK.pie;_pieMarkType=wX.arc;static mark={...Mq.mark,[UK.pie]:{name:UK.pie,type:wX.arc},[UK.labelLine]:{name:UK.labelLine,type:wX.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=AN;_endAngle=kN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=Ki(t),r=Ki(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(Ki(this._spec?.startAngle)?kl(this._spec.startAngle):this._startAngle,Ki(this._spec?.endAngle)?kl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=Ki(this._spec?.padAngle)?kl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;ZX(this._dataSet,"pie",IJ),ZX(this._dataSet,"arcLabel",DJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:lN,asEndAngle:hN,asRatio:oN,asMiddleAngle:xN,asRadian:wN,asQuadrant:SN,asK:cN}},!1);const e=new jo(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${Jj}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new vq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...HJ.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:zZ(this._spec.animation,this._spec.morph,LZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark(HJ.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark(HJ.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Yh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Yh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Hl(lN).bind(this),endAngle:Hl(hN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",W$.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,W$.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Hl(sN).bind(this),x:Hl(rN).bind(this),y:Hl(aN).bind(this),text:Hl(nN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Hl(iN).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[xN];return"inside"===this._spec.label?.position?Ml(e):0},limit:Hl(eN).bind(this)},void 0,W$.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Hl(sN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(L$.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return t?.outerRadius&&(e.outerRadius=()=>this.computeLayoutRadius()*t?.outerRadius),t?.innerRadius&&(e.innerRadius=()=>this.computeLayoutRadius()*t?.innerRadius),t?.cornerRadius&&(e.cornerRadius=()=>this.computeLayoutRadius()*t?.cornerRadius),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${Jj}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${Jj}_ARC_LABEL_${e}_AY`])} L${Math.round(t[fN])},${Math.round(t[mN])} L${Math.round(t[yN])},${Math.round(t[_N])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(Xi(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[xN];if(Xi(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=Cl({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[xN];if(Xi(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=Cl({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===oK.appear)return this._startAngle;if(i===oK.disappear)return this._endAngle;const n=[oK.disappear,oK.exit],s=e.mark.elements,r=t,a=r?.[H$];if(void 0===s.find((t=>t.data[0]?.[H$]t.data[0]?.[H$]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[H$]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Cl({angle:e[xN],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Cl({angle:e[xN],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Cl({angle:e[xN],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Cl({angle:e[xN],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class jJ extends HJ{static type=GK.pie;type=GK.pie}class NJ extends FJ{static type=wX.arc3d;type=NJ.type}fK.useMark([CJ,NZ,NJ]);class VJ extends HJ{static type=GK.pie3d;type=GK.pie3d;_pieMarkName=UK.pie3d;_pieMarkType=wX.arc3d;static mark={...Mq.mark,[UK.pie3d]:{name:UK.pie3d,type:wX.arc3d},[UK.labelLine]:{name:UK.labelLine,type:wX.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Hl(lN).bind(this),endAngle:Hl(hN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",W$.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,W$.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Hl(rN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Hl(aN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Hl(sN).bind(this),x:Hl(rN).bind(this),y:Hl(aN).bind(this),text:Hl(nN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Hl(iN).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[xN];return"inside"===this._spec.label?.position?Ml(e):0},limit:Hl(eN).bind(this),...n},void 0,W$.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Hl(sN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const WJ=[10,20],UJ=jl.Linear,GJ="circle",YJ=jl.Ordinal,$J=["circle","square","triangle","diamond","star"];fK.useMark([ZZ,NZ]);class XJ extends Cq{static type=GK.scatter;type=GK.scatter;static mark={...Mq.mark,[UK.point]:{name:UK.point,type:wX.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if($i(e))return e;if(en(e)){if(Xi(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${Jj}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(qi(e)){if(Xi(t))throw new Error(`${s}Field is required.`);const r={id:`${Jj}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return Xi(e)?10:rn(e)?e:!tn(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:UJ,defaultRange:WJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return Xi(e)?GJ:tn(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:YJ,defaultRange:$J},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(XJ.mark.point,{morph:zZ(this._spec.animation,this._spec.morph,LZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:xn({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(DZ(BZ.scatter({},t),LZ(UK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:rn(this._size)||$i(this._size)?this._size:10,shape:tn(this._shape)||$i(this._shape)?this._shape:GJ},hK.STATE_NORMAL,W$.Series),(Ki(this._sizeField)||Ki(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},hK.STATE_NORMAL,W$.User_Mark),(Ki(this._shapeField)||Ki(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},hK.STATE_NORMAL,W$.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},hK.STATE_NORMAL,W$.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class KJ extends BJ{getStackGroupFields(){return this._angleField}getStackValueField(){return Cn(this._spec.valueField)[0]||Cn(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(G$),this.setInnerRadiusField(U$)}setValueFieldToPercent(){this.setRadiusField($$),this.setInnerRadiusField(Y$)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}fK.useMark([zJ,NZ]);class qJ extends KJ{static type=GK.rose;type=GK.rose;static mark={...VZ.mark,[UK.rose]:{name:UK.rose,type:wX.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(qJ.mark.rose,{morph:zZ(this._spec.animation,this._spec.morph,LZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(qJ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Gh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Gh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Gh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(Ml(e)??0)+90},void 0,W$.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(DZ(BZ.rose(e,t),LZ(UK.rose,this._spec)))}}}fK.useMark([cJ,iJ,ZZ,NZ]);class ZJ extends KJ{static type=GK.radar;type=GK.radar;static mark={...Mq.mark,...tJ,[UK.area]:{name:UK.area,type:wX.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(ZJ.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:EX},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:kl(this._spec.startAngle)??AN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(DZ(BZ.radarGroup(t,e),LZ(UK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(Ki(i)){const s=BZ[n];i.setAnimationConfig(DZ(s(t,e),LZ(i.name,this._spec)))}}))}}Mn(ZJ,QZ);class JJ extends pq{updateTooltipSpec(){super.updateTooltipSpec(),Ki(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>No.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const QJ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},tQ={fill:"#bbb",fillOpacity:.2};fK.useMark([ZZ,NZ,WZ,jZ]);class eQ extends Cq{static type=GK.dot;type=GK.dot;static mark={...Mq.mark,[UK.group]:{name:UK.group,type:wX.group},[UK.grid]:{name:UK.grid,type:wX.rule},[UK.gridBackground]:{name:UK.gridBackground,type:wX.rect},[UK.dot]:{name:UK.dot,type:wX.symbol},[UK.title]:{name:UK.title,type:wX.text},[UK.subTitle]:{name:UK.subTitle,type:wX.text},[UK.symbol]:{name:UK.symbol,type:wX.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){Ki(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){Ki(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){Ki(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){Ki(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){Ki(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){Ki(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),ZX(this._option.dataSet,"objFlat",QJ),ZX(this._option.dataSet,"copyDataView",nK),JX(this._option.dataSet,"dataview",Lo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){Ki(t)&&(this._seriesField=t,this.getMarksInType([wX.line,wX.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(xn(tQ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(eQ.mark.group),this._containerMark=this._createMark(eQ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(eQ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(eQ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(eQ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(eQ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(eQ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(eQ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",W$.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",W$.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",W$.Series),this._trigger.registerMark(i));const n=this._gridMark;n&&(this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",W$.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",W$.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",W$.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",W$.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(o))}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??N$}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Oh(this._option.getTheme().colorScheme,this.type);return(new Vh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??N$}}initTooltip(){this._tooltipHelper=new JJ(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class iQ extends pq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>No.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}fK.useMark([WZ,ZZ]);class nQ extends Cq{static type=GK.link;type=GK.link;static mark={...Mq.mark,[UK.group]:{name:UK.group,type:wX.group},[UK.link]:{name:UK.link,type:wX.rule},[UK.arrow]:{name:UK.arrow,type:wX.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){Ki(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){Ki(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){Ki(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){Ki(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();ZX(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(nQ.mark.group),this._containerMark=this._createMark(nQ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(nQ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(nQ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",W$.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",W$.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",W$.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?RX.triangleDown:RX.triangleUp},"normal",W$.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??N$}}initTooltip(){this._tooltipHelper=new iQ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class sQ extends BJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=kl(this._spec.startAngle)??kl(t?.startAngle)??AN,this._endAngle=kl(this._spec.endAngle)??kl(t?.endAngle)??kN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||Ki(n?.startAngle)||Ki(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Gh(this.angleAxisHelper.dataToPosition([t[U$]]),this.angleAxisHelper.getScale(0));if(an(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Gh(this.angleAxisHelper.dataToPosition([t[G$]]),this.angleAxisHelper.getScale(0));if(an(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class rQ extends FJ{static type=wX.arc;static constructorType=wX.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){Ki(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),Ki(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const l=Ki(t.innerPadding)&&Ki(a)||Ki(t.outerPadding)&&Ki(o),h=Ki(t.innerRadius)&&s||Ki(t.outerRadius)&&r;if(l||h){const e=Object.assign({},t);return s&&Ki(a)&&($i(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+($i(s)?s(t,e,i,n):s):$i(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&Ki(o)&&($i(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-($i(r)?r(t,e,i,n):r):$i(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}fK.useMark([zJ,rQ]);class aQ extends sQ{static type=GK.circularProgress;type=GK.circularProgress;static mark={...Mq.mark,[UK.track]:{name:UK.track,type:wX.progressArc},[UK.progress]:{name:UK.progress,type:wX.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(aQ.mark.track),this._progressMark=this._createMark(aQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(an(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(an(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(DZ(BZ.circularProgress({startAngle:this._startAngle},t),LZ(UK.progress,this._spec))),this._trackMark.setAnimationConfig(DZ(BZ.progressBackground(),LZ(UK.track,this._spec)))}}class oQ extends pq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}fK.useMark([jZ]);class lQ extends Cq{static type=GK.linearProgress;type=GK.linearProgress;static mark={...Mq.mark,[UK.track]:{name:UK.track,type:wX.rect},[UK.progress]:{name:UK.progress,type:wX.rect},[UK.group]:{name:UK.group,type:wX.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(lQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Gh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Gh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Gh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Gh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(lQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Gh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Gh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(lQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Gh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(uB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Gh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(uB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",W$.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(DZ(BZ.linearProgress(t,e),LZ(UK.progress,this._spec))),this._trackMark.setAnimationConfig(DZ(BZ.progressBackground(),LZ(UK.track,this._spec)))}initTooltip(){this._tooltipHelper=new oQ(this)}}const hQ=[0],cQ=[20,40],dQ=[200,500],uQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},pQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],gQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:fQ,triangle:fQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function fQ(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function mQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const yQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function _Q(t){return $i(t)?t:function(){return t}}class vQ{constructor(t){var e,i;switch(this.options=Object.assign({},vQ.defaultOptions,t),$i(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>gQ[t]?gQ[t]():gQ.circle())(this.options.shape),this.getText=null!==(e=_Q(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=_Q(this.options.fontWeight),this.getTextFontSize=_Q(this.options.fontSize),this.getTextFontStyle=_Q(this.options.fontStyle),this.getTextFontFamily=_Q(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>yQ(10,50);break;case"random-light":this.getTextColor=()=>yQ(50,90);break;default:this.getTextColor=_Q(this.options.color)}if(Xi(this.options.rotate)){if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}}else this.getTextRotate=$i(this.options.rotate)?t=>{var e;return Es(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Es(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!Xi(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class xQ extends vQ{constructor(t){var e;super(Object.assign({},xQ.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.spiral=tn(this.options.spiral)?null!==(e=bQ[this.options.spiral])&&void 0!==e?e:bQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=_Q(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:n}=mQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));for(this.data=r;s>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(kQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(AQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}kQ(p,this._size)&&(p=MQ(p,this._size))}else if(kQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||wQ(p,i))&&(!i||!SQ(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function SQ(t,e,i){const n=i[0]>>5,s=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function wQ(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,kQ=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function MQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),Pn(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=mQ(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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(;ie.left+e.width||t.top>e.top+e.height)}TQ.defaultOptions={enlarge:!1};const RQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},PQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?BQ(t.fontFamily):"sans-serif",u=t.fontStyle?BQ(t.fontStyle):"normal",p=t.fontWeight?BQ(t.fontWeight):"normal",g=t.rotate?BQ(t.rotate):0,f=BQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?BQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",v=null!==(r=t.shrink)&&void 0!==r&&r,b=null!==(a=t.enlarge)&&void 0!==a&&a,x=null!==(o=t.clip)&&void 0!==o&&o,S=null!==(l=t.minFontSize)&&void 0!==l?l:0,w=t.randomVisible,A=t.as||RQ,k=t.depth_3d,M=t.postProjection;let C=t.fontSize?BQ(t.fontSize):14;const T=t.fontSizeRange;if(T&&!rn(C)){const t=C;C=e=>IQ(t(e),DQ(t,h),T)}let E=xQ;"fast"===t.layoutType?E=TQ:"grid"===t.layoutType&&(E=CQ);const R=new E({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:C,shrink:v,clip:x,enlarge:b,minFontSize:S,random:w,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},BQ=t=>tn(t)||rn(t)||$i(t)?t:e=>e[t.field],IQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],DQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function LQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),zQ=(t,e)=>{let i=0;for(const e of t)FQ(e)?i+=1:i+=.53;return i};function HQ(t){return on(t)?new Promise(((e,i)=>{const n=mB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{ll().error("image 加载失败!",t)}})):null}var jQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function NQ(t){return jQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield HQ(e);r&&(a=yield function(t,e,i){return jQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&WQ(s,n,a-1);)--a;for(;oo&&UQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield HQ(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||VQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function VQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function WQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=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")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||XQ(e,t,r)))return $Q(e,t,r),!0}return!1}function $Q(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function XQ(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function KQ(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(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,s,u).data;let f,m;for(;--n>=p;){const t=i[n];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;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(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 qQ(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=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++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=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?GQ(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=qQ(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return GQ(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){KQ(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!XQ(i,y,_)&&($Q(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var QQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const t0={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},e0=(t,e,i,n)=>QQ(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||hl("WordcloudShape shape must be specified."),t.text||hl("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(OQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||t0;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=yj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield NQ(l),p=t.colorMode||"ordinal",g={getText:a0(t.text),getFontSize:a0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?a0(t.colorField):a0(t.text),getFillingColor:a0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:a0(t.colorHexField),getFontFamily:a0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:a0(t.padding||1),getFontStyle:a0(t.fontStyle||"normal"),getFontWeight:a0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?a0(t.fontOpacity):()=>1};n0(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:a0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:a0(t.fillingFontStyle||"normal"),getFillingFontWeight:a0(t.fillingFontWeight||"normal"),getFillingPadding:a0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((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{const i=zQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,R=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),P=Math.max(...R.map((t=>t.fontSize)));R.forEach((t=>t.weight=t.fontSize/P)),R.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield JQ(R,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(OQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),i0=(t,e,i,n)=>{var s,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 Yl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Yl).domain(e).range(f).scale(t)}}else(new xh).domain(r0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new xh).domain(r0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},n0=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new Eh).domain(r0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&$i(s)&&!n){const e=.5,[o,l]=(i.shapeArea,r0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=s0(h,i,!0);n=[~~(e*c),~~c];const d=(new Eh).domain(r0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=s0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},s0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=zQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},a0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:$i(t)?t:e=>e[t.field]:null,o0=`${Jj}_WORD_CLOUD_ANGLE`,l0=`${Jj}_WORD_CLOUD_FILLING_ANGLE`,h0=`${Jj}_WORD_CLOUD_WEIGHT`,c0=`${Jj}_WORD_CLOUD_TEXT`;fK.useMark([NZ]),PN("wordcloud",{transform:PQ,markPhase:"beforeJoin"},!0),PN("wordcloudShape",{transform:e0,markPhase:"beforeJoin"},!0);class d0 extends Mq{static mark={...Mq.mark,[UK.word]:{name:UK.word,type:wX.text},[UK.fillingWord]:{name:UK.fillingWord,type:wX.text}};_nameField;_valueField;setValueField(t){Ki(t)&&(this._valueField=t,this.setFontSizeRange(cQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){Ki(t)&&Ki(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??dQ,this._rotateAngles=this._spec.rotateAngles??hQ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:uQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:hQ,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!pQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(d0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(d0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?c0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",W$.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(DZ(BZ.wordCloud(),LZ(UK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Oh(this._option.getTheme().colorScheme,this.type);return(new Vh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??N$};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new xh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=yl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:h0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:o0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:l0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:c0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?c0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:j$,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?c0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:Ko(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:j$,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:o0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class u0 extends d0{static type=GK.wordCloud;type=GK.wordCloud}class p0 extends d0{static type=GK.wordCloud3d;type=GK.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new xh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=yl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:h0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:o0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:l0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:c0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?c0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:j$,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:j$,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:o0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(d0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(d0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",W$.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(DZ(BZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),LZ(UK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(DZ(BZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),LZ(UK.fillingWord,this._spec)))}}const g0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=an(y*f)?y/f:null,b=an(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:b),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},f0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},m0=`${Jj}_FUNNEL_TRANSFORM_RATIO`,y0=`${Jj}_FUNNEL_REACH_RATIO`,_0=`${Jj}_FUNNEL_HEIGHT_RATIO`,v0=`${Jj}_FUNNEL_VALUE_RATIO`,b0=`${Jj}_FUNNEL_LAST_VALUE_RATIO`,x0=`${Jj}_FUNNEL_NEXT_VALUE_RATIO`,S0=`${Jj}_FUNNEL_LAST_VALUE`,w0=`${Jj}_FUNNEL_CURRENT_VALUE`,A0=`${Jj}_FUNNEL_NEXT_VALUE`,k0=`${Jj}_FUNNEL_TRANSFORM_LEVEL`,M0=20;class C0 extends pq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===UK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===UK.transform){const e=t?.[y0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===UK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return Ki(n[0])?t?.[n[0]]:t?.[s]}}class T0 extends NK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class E0 extends T0{static type=wX.polygon;type=E0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}fK.useMark([E0,NZ,WZ]);class R0 extends Mq{static type=GK.funnel;type=GK.funnel;_funnelMarkName=UK.funnel;_funnelMarkType=wX.polygon;_transformMarkName=UK.transform;_transformMarkType=wX.polygon;static mark={...Mq.mark,[UK.funnel]:{name:UK.funnel,type:wX.polygon},[UK.transform]:{name:UK.transform,type:wX.polygon},[UK.transformLabel]:{name:UK.transformLabel,type:wX.text},[UK.outerLabel]:{name:UK.outerLabel,type:wX.text},[UK.outerLabelLine]:{name:UK.outerLabelLine,type:wX.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",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._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;ZX(this._dataSet,"funnel",g0),ZX(this._dataSet,"funnelTransform",f0);const t=new jo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Jj}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new vq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:w0,asTransformRatio:m0,asReachRatio:y0,asHeightRatio:_0,asValueRatio:v0,asNextValueRatio:x0,asLastValueRatio:b0,asLastValue:S0,asNextValue:A0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:k0}})}initMark(){if(this._funnelMark=this._createMark({...R0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:zZ(this._spec.animation,this._spec.morph,LZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...R0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(R0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(R0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(R0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(R0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new C0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>Ki(t[this._valueField]),fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",W$.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Hl(y0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",W$.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",W$.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",W$.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(DZ(BZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),LZ(UK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(DZ(BZ.funnel({},t),LZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(DZ(BZ.label(),LZ(UK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[b0])/2:this._getSecondaryAxisLength(t[v0])/2,s=this._getSecondaryAxisLength(t[v0])/2):(n=this._getSecondaryAxisLength(t[v0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[x0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[k0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return Ki(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!Ki(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(rn(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-M0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",W$.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",W$.Series)}}function I0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==s?void 0:s.key)&&void 0!==h?h:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=O0(t.children,d.children,i+1,o,d,r);d.value=Xi(t.value)?e.sum:Math.max(e.sum,d.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=Xi(t.value)?0:t.value;a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},F0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=F0(t.children,e,t,s))})),n},z0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=z0(t.children,e,t,s)),s=e(t,n,i,s)})),s},H0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:I0,slice:D0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?D0:I0)(t,e,i,n,s)}};class j0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},j0.defaultOpionts,t);const i=this.options.nodeKey,n=$i(i)?i:i?dl(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?L0(this.options.aspectRatio):null!==(e=H0[this.options.splitType])&&void 0!==e?e:H0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},s=[],r=O0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(rn(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(rn(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}j0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const N0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class V0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];I0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),N0);const n=en(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],n)return this._layoutLabel(t,Yi(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},V0.defaultOpionts,t):Object.assign({},V0.defaultOpionts);const e=this.options.nodeKey,i=$i(e)?e:e?dl(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+vl(this.options.center[0],t.width),n=t.y0+vl(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=en(r),l=o?r.map((t=>vl(t,s))):vl(r,s),h=en(a),c=this.options.gapRadius,d=h?a.map((t=>vl(t,s))):vl(a,s),u=Bn(0,e+1);if(o)this._parsedInnerRadius=u.map(((t,e)=>{const i=l[e];return Xi(i)?s:i})),this._parsedOutterRadius=u.map(((t,i)=>{var n;return h?d[i]:iXi(d[e])?s:d[e])),this._parsedInnerRadius=u.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(en(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=vl(r,s),i=(d-t)/(e+1);this._parsedInnerRadius=u.map(((e,n)=>t+n*i)),this._parsedOutterRadius=u.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(en(c)?null!==(n=c[e])&&void 0!==n?n:0:c)}))}this._parsedCenter=[i,n],this._maxRadius=s}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],s=O0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Is({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}V0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const W0=4294967296;function U0(t,e){let i,n;if($0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function $0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function Z0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function J0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function Q0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function t1(t){return{_:t,next:null,prev:null}}function e1(t,e){const i=(t=Cn(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];Z0(s,n,r);let a,o,l,h,c,d,u,p=t1(n),g=t1(s),f=t1(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:en(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const l=[],h=O0(t,l,0,-1,null,this._getNodeKey);this._maxDepth=h.maxDepth;const c=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%W0)/W0}(),d={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:h.sum,datum:null,children:l,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=$i(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:r1.defaultOpionts.nodeSort;F0([d],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)F0([d],i1(this.options.setRadius)),z0([d],n1(this._getPadding,.5,c)),F0([d],s1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);F0([d],i1(r1.defaultOpionts.setRadius)),z0([d],n1(pl,1,c)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&z0([d],n1(this._getPadding,d.radius/t,c)),F0([d],s1(t/(2*d.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[d]:l}}r1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const a1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):a1(t.children,e,i)))})),e},o1=(t,e={})=>{if(!t)return[];const i=[];return a1(t,i,e),i},l1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new V0(i).layout(t,{width:n,height:s})};class h1 extends pq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var c1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(c1||(c1={}));const d1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(Xi(s))return t;if(i.type===c1.DrillDown){return Cn(_X(t,s,n,"children"))}if(i.type===c1.DrillUp){const e=vX(t,s,n,"children");if(e)return Cn(e)}return t};class u1{pointerId;parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}parserDragEvent(){return!0}}class p1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!0)}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}}const g1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:u1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:u1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:p1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:p1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:p1}};class f1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return g1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===n.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;ZX(t,"drillFilter",d1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(Xi(t.datum)||Xi(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!en(t)||un(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:c1.DrillDown},e().reRunAllTransform(),i.emit(L$.drill,{value:{path:t,type:c1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!en(i)||un(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:c1.DrillUp},t().reRunAllTransform(),e.emit(L$.drill,{value:{path:i,type:c1.DrillUp},model:this}),i}}fK.useMark([zJ,NZ]);class m1 extends BJ{static type=GK.sunburst;type=GK.sunburst;static mark={...Mq.mark,[UK.sunburst]:{name:UK.sunburst,type:wX.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??xq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??j$,getRawData:()=>this.getRawData()}),this._startAngle=Es(this._spec.startAngle),this._endAngle=Es(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),ZX(this._dataSet,"sunburstLayout",l1),ZX(this._dataSet,"flatten",o1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[Ki(this._centerX)?this._centerX:this.getLayoutRect().width/2,Ki(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:bq,operations:["max","min","values"]},{key:xq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();Xi(t?.dataSet)||(ZX(t.dataSet,"addVChartProperty",nq),t.transform({type:"addVChartProperty",options:{beforeCall:wq,call:kq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(m1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){Xi(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(Ki(this._offsetX)?this._offsetX:0),y:t=>t.y+(Ki(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},hK.STATE_NORMAL,W$.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(m1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){Xi(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return qi(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(Ki(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(Ki(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},hK.STATE_NORMAL,W$.Series)}initTooltip(){this._tooltipHelper=new h1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(Cn(this.__innerRadius))[0],outerRadius:this._computeRadius(Cn(this.__outerRadius))[0],startAngle:Cn(this._startAngle)[0],endAngle:Cn(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(wX.arc).forEach((i=>{i.setAnimationConfig(DZ(BZ.sunburst(t,e),LZ(i.name,this._spec)))})),this.getMarksInType(wX.text).forEach((t=>{t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(en(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}Mn(m1,f1);const y1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new r1(i).layout(t,{width:n,height:s})};class _1 extends pq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}fK.useMark([zJ,NZ]);class v1 extends Cq{static type=GK.circlePacking;type=GK.circlePacking;static mark={...Mq.mark,[UK.circlePacking]:{name:UK.circlePacking,type:wX.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??xq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??j$,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();Xi(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),ZX(this._dataSet,"circlePackingLayout",y1),ZX(this._dataSet,"flatten",o1),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{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();Xi(t?.dataSet)||(ZX(t.dataSet,"addVChartProperty",nq),t.transform({type:"addVChartProperty",options:{beforeCall:wq,call:kq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(v1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){Xi(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},hK.STATE_NORMAL,W$.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(v1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){Xi(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},hK.STATE_NORMAL,W$.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:bq,operations:["max","min","values"]},{key:xq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new _1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(wX.arc).forEach((e=>{e.setAnimationConfig(DZ(BZ.circlePacking({},t),LZ(e.name,this._spec)))})),this.getMarksInType(wX.text).forEach((t=>{t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}Mn(v1,f1);const b1=t=>{let e=0;return t.forEach(((t,i)=>{var n;Xi(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=b1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function x1(t){return t.depth}function S1(t,e){return e-1-t.endDepth}const w1=(t,e)=>t.y0-e.y0,A1={left:x1,right:S1,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?En(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:x1,end:S1};class k1{constructor(t){this._ascendingSourceBreadth=(t,e)=>w1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>w1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},k1.defaultOptions,t);const e=this.options.nodeKey,i=$i(e)?e:e?dl(e):null;this._getNodeKey=i,this._alignFunc=$i(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):A1[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];b1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(Xi(s.source)||Xi(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&hl("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&hl("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(tn(e)){const t=Kn(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(rn(e)){if(r=e,rn(i))a=i;else if(Xi(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else $i(e)&&rn(i)&&(a=i);const l=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}Xi(this.options.nodeSortBy)&&s.sort(w1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(w1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new k1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},C1=(t,e)=>{if(!t||!e?.view||!en(t))return t;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 t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new k1(e),s=[];return s.push(n.layout(t,i)),s},T1=t=>t&&en(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],E1=t=>t&&en(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class R1 extends pq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(rn(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class P1 extends NK{static type=wX.linkPath;type=P1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){ZN("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(lW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),QV("linkPathGrowIn",hW),QV("linkPathGrowOut",cW),QV("linkPathUpdate",dW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}fK.useMark([jZ,P1,NZ]),PN("sankey",{transform:M1,markPhase:"beforeJoin"},!0);class B1 extends Cq{static type=GK.sankey;type=GK.sankey;static mark={...VZ.mark,[UK.node]:{name:UK.node,type:wX.rect},[UK.link]:{name:UK.link,type:wX.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=J$.Node;_labelLayoutZIndex=J$.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Cs;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){ZX(this._dataSet,"sankey",C1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new zo;JX(t,"dataview",Lo),ZX(t,"sankeyNodes",T1),ZX(t,"addVChartProperty",nq);const e=new jo(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1),this._nodesSeriesData=new vq(this._option,e);const i=new zo;JX(i,"dataview",Lo),ZX(i,"sankeyLinks",E1),ZX(i,"addVChartProperty",nq);const n=new jo(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1),this._linksSeriesData=new vq(this._option,n)}}initMark(){const t=this._createMark(B1.mark.node,{isSeriesMark:!0,key:H$,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(B1.mark.link,{key:H$,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(B1.mark.label,{key:H$,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},hK.STATE_NORMAL,W$.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},hK.STATE_NORMAL,W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},hK.STATE_NORMAL,W$.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(DZ(BZ.sankeyNode(t,e),LZ(UK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(DZ(BZ.sankeyLinkPath(),LZ(UK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:F$.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:F$.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:F$.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:F$.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(Cn(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||Cn(s[r]).includes(e.source)&&Cn(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(Cn(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new R1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Oh(this._option.getTheme().colorScheme,this.type),n=new Vh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const I1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new j0(e).layout(t,i)},D1=(t,e)=>{let i={},n=e.fields;if($i(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=o1(s);return i=yq([{latestData:r}],e),i};class L1 extends pq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class O1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,g1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return g1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:F$.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:F$.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;Xi(s)||Kh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){g1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){g1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){g1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){g1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:F$.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:F$.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;Xi(s)&&Xi(r)||Kh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:F$.chart},(t=>{if(!t.event)return;const{event:n}=t;Kh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:F$.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){g1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:F$.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){g1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:F$.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:F$.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:F$.chart,source:O$.chart},l),this._eventObj.off(n,{level:F$.chart,source:O$.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:F$.chart,source:O$.chart},l),this._eventObj.on(n,{level:F$.chart,source:O$.chart},o)}}fK.useMark([jZ,NZ]);class F1 extends Cq{static type=GK.treemap;type=GK.treemap;static mark={...Mq.mark,[UK.nonLeaf]:{name:UK.nonLeaf,type:wX.rect},[UK.leaf]:{name:UK.leaf,type:wX.rect},[UK.nonLeafLabel]:{name:UK.nonLeafLabel,type:wX.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Cs;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??xq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ls),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??j$,getRawData:()=>this.getRawData()}),an(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),ZX(this._dataSet,"treemap",I1),ZX(this._dataSet,"flatten",o1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(ZX(this._rawData.dataSet,"addVChartProperty",nq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:wq,call:kq.bind(this)}}))}_statisticRawData(){const t=`${Jj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){ZX(this._dataSet,"hierarchyDimensionStatistics",D1),ZX(this._dataSet,"flatten",o1);const i=new jo(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 super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:bq,operations:["max","min","values"]},{key:xq,operations:["values"]}])}initMark(){const t=this._createMark(F1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(F1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(F1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(F1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},hK.STATE_NORMAL,W$.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()},hK.STATE_NORMAL,W$.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},hK.STATE_NORMAL,W$.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},hK.STATE_NORMAL,W$.Series)}initAnimation(){this.getMarksInType(wX.rect).forEach((t=>{t.setAnimationConfig(DZ(BZ.treemap(),LZ(t.name,this._spec)))})),this.getMarksInType(wX.text).forEach((t=>{t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))}))}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 L1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(uV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(uV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}Mn(F1,O1),Mn(F1,f1),fK.useMark([CJ,jZ]);class z1 extends sQ{static type=GK.gaugePointer;type=GK.gaugePointer;static mark={...Mq.mark,[UK.pin]:{name:UK.pin,type:wX.path},[UK.pinBackground]:{name:UK.pinBackground,type:wX.path},[UK.pointer]:{name:UK.pointer,type:[wX.path,wX.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?wX.rect:wX.path}initMark(){this._pinBackgroundMark=this._createMark(z1.mark.pinBackground),this._pointerMark=this._createMark({...z1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(z1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===wX.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return Ki(this.radiusAxisHelper)&&Ki(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(DZ(BZ.circularProgress({startAngle:this._startAngle},t),LZ(UK.pointer,this._spec)))}}fK.useMark([rQ]);class H1 extends sQ{static type=GK.gauge;type=GK.gauge;static mark={...Mq.mark,[UK.segment]:{name:UK.segment,type:wX.progressArc},[UK.track]:{name:UK.track,type:wX.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=kl(this._spec.padAngle??0)}initData(){super.initData();ZX(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[Z$]=t[this._angleField[0]],t[q$]=e>0?i[e-1][Z$]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(H1.mark.track),this._segmentMark=this._createMark(H1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(Ki(t[q$])?this.angleAxisHelper.dataToPosition([t[q$]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[Z$]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(DZ(BZ.circularProgress({startAngle:this._startAngle},t),LZ(UK.segment,this._spec)))}}class j1 extends pq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return Ki(i)&&"dimension"===t&&(i.visible=!1),i}}class N1 extends qZ{static type=wX.cell;type=N1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}fK.useMark([N1,NZ]);class V1 extends Cq{static type=GK.heatmap;type=GK.heatmap;static mark={...Mq.mark,[UK.cell]:{name:UK.cell,type:wX.cell},[UK.cellBackground]:{name:UK.cellBackground,type:wX.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Cn(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(V1.mark.cell,{morph:zZ(this._spec.animation,this._spec.morph,LZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:xn({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(V1.mark.cellBackground,{progressive:t})}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",W$.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=Tr(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",W$.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(DZ(BZ.heatmap(t),LZ(UK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new j1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}fK.useSeries([dJ]);class W1 extends qK{static type=YK.area;static view="singleDefault";type=YK.area;seriesType=GK.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([VZ]);class U1 extends qK{static type=YK.bar;static view="singleDefault";type=YK.bar;seriesType=GK.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([rJ]);class G1 extends qK{static type=YK.bar3d;static view="singleDefault";type=YK.bar3d;seriesType=GK.bar3d}fK.useSeries([JZ]);class Y1 extends qK{static type=YK.boxPlot;static view="singleDefault";type=YK.boxPlot;seriesType=GK.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??$h.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===$h.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),ZK(t)}}fK.useSeries([v1]);class $1 extends KK{static type=YK.circlePacking;static view="singleDefault";type=YK.circlePacking;seriesType=GK.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=GK.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class X1 extends KK{static type=YK.common;static view="singleDefault";type=YK.common}class K1 extends KK{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([R0]);class q1 extends K1{static type=YK.funnel;static view="singleDefault";type=YK.funnel;seriesType=GK.funnel}fK.useSeries([B0]);class Z1 extends K1{static type=YK.funnel3d;static view="singleDefault";type=YK.funnel3d;seriesType=GK.funnel3d}const J1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Q1(t){let e=0;return pn(t,"tick.visible")&&(e+=pn(t,"tick.tickSize")),pn(t,"label.visible")&&(e+=pn(t,"label.space")),e}function t2(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function e2(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function i2(t){const e=t?.orient;return"angle"===e||"radius"===e}const n2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return xn({},o,("band"===e?n:"linear"===e?s:{})??{},BX(t)?r:a)},s2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return xn({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class r2 extends KK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=Cn(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return Ki(i)&&e.forEach((t=>{Xi(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],Ki(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class a2 extends r2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),Xi(n.angle.type)&&(n.angle.type="linear"),Xi(n.radius.type)&&(n.radius.type="band");const s=t2(n.angle,{min:0,max:1});Xi(n.angle.min)&&(n.angle.min=s.min),Xi(n.angle.max)&&(n.angle.max=s.max)}}fK.useSeries([z1,H1]);class o2 extends a2{static type=YK.gauge;static view="singleDefault";type=YK.gauge;seriesType=GK.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:GK.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===GK.gauge||t.type===GK.circularProgress));Xi(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&Xi(e.radiusField)&&Xi(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===GK.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),Xi(e.angle.type)&&(e.angle.type="linear"),Xi(e.radius.type)&&(e.radius.type="linear")}}fK.useSeries([V1]);class l2 extends qK{static type=YK.heatmap;static view="singleDefault";type=YK.heatmap;seriesType=GK.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class h2 extends qK{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}fK.useSeries([VZ]);class c2 extends h2{static type=YK.histogram;static view="singleDefault";type=YK.histogram;seriesType=GK.bar;transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([rJ]);class d2 extends h2{static type=YK.histogram3d;static view="singleDefault";type=YK.histogram3d;seriesType=GK.bar3d}fK.useSeries([nJ]);class u2 extends qK{static type=YK.line;static view="singleDefault";type=YK.line;seriesType=GK.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([PJ]);class p2 extends KK{static type=YK.map;static view="singleDefault";type=YK.map;seriesType=GK.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area}}isValidSeries(t){return t===GK.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class g2 extends r2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}fK.useSeries([jJ]);class f2 extends g2{static type=YK.pie;static view="singleDefault";type=YK.pie;seriesType=GK.pie}fK.useSeries([VJ]);class m2 extends g2{static type=YK.pie3d;static view="singleDefault";type=YK.pie3d;seriesType=GK.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}fK.useSeries([aQ]);class y2 extends a2{static type=YK.circularProgress;static view="singleDefault";type=YK.circularProgress;seriesType=GK.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}fK.useSeries([lQ]);class _2 extends qK{static type=YK.linearProgress;static view="singleDefault";type=YK.linearProgress;seriesType=GK.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),Xi(i.type)&&(i.type="band"),Xi(e.type)&&(e.type="linear");const n=t2(e,{min:0,max:1});Xi(e.min)&&(e.min=n.min),Xi(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),Xi(i.type)&&(i.type="linear"),Xi(e.type)&&(e.type="band");const n=t2(i,{min:0,max:1});Xi(i.min)&&(i.min=n.min),Xi(i.max)&&(i.max=n.max)}}}class v2 extends r2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}fK.useSeries([ZJ]);class b2 extends v2{static type=YK.radar;static view="singleDefault";type=YK.radar;seriesType=GK.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:xn({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=Cn(t.crosshair||{}).map((t=>xn({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}fK.useSeries([pJ]);class x2 extends qK{static type=YK.rangeArea;static view="singleDefault";type=YK.rangeArea;seriesType=GK.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===$h.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([lJ]);class S2 extends qK{static type=YK.rangeColumn;static view="singleDefault";type=YK.rangeColumn;seriesType=GK.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===$h.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([hJ]);class w2 extends qK{static type=YK.rangeColumn3d;static view="singleDefault";type=YK.rangeColumn3d;seriesType=GK.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===$h.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}fK.useSeries([qJ]);class A2 extends v2{static type=YK.rose;static view="singleDefault";type=YK.rose;seriesType=GK.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??TN,outerRadius:t.outerRadius??TN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=Cn(t.crosshair||{}).map((t=>xn({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}fK.useSeries([B1]);class k2 extends KK{static type=YK.sankey;static view="singleDefault";type=YK.sankey;seriesType=GK.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([XJ]);class M2 extends qK{static type=YK.scatter;static view="singleDefault";type=YK.scatter;seriesType=GK.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}fK.useSeries([eQ,nQ]);class C2 extends KK{static type=YK.sequence;static view="singleDefault";type=YK.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==GK.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[GK.bar,GK.line,GK.area,GK.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===GK.dot?"band":"linear",visible:t.type!==GK.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===GK.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===GK.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=rK(t.data,this._dataSet,this._spec.data),t.type===GK.link&&(t.dataDot=rK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===GK.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===GK.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=AX.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}fK.useSeries([m1]);class T2 extends KK{static type=YK.sunburst;static view="singleDefault";type=YK.sunburst;seriesType=GK.sunburst;getDefaultSeriesSpec(t){const e=Ki(t.startAngle)?t.startAngle:MN,i=Ki(t.endAngle)?t.endAngle:e+Rs(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=GK.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([F1]);class E2 extends KK{static type=YK.treemap;static view="singleDefault";type=YK.treemap;seriesType=GK.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([UZ]);class R2 extends U1{static type=YK.waterfall;static view="singleDefault";type=YK.waterfall;seriesType=GK.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&Cn(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),ZK(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class P2 extends KK{type=YK.wordCloud;seriesType=GK.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([u0]);class B2 extends P2{static type=YK.wordCloud;static view="singleDefault";type=YK.wordCloud;seriesType=GK.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}fK.useSeries([p0]);class I2 extends P2{static type=YK.wordCloud3d;static view="singleDefault";type=YK.wordCloud3d;seriesType=GK.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class D2{plugins;id=Qo();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Uo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this.plugins.find((e=>e.id===t))}getAll(){return this.plugins.slice()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function L2(t){const e={...t};return un(t.style)||(e.textStyle=SX(t.style)),un(t.textStyle)||xn(e.textStyle,SX(t.textStyle)),t.shape?.style&&SX(e.shape.style),t.background?.style&&SX(e.background.style),e}function O2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class F2 extends kK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new D2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new BK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case n.cartesianBandAxis:return n2(LX(i),"band",e);case n.cartesianLinearAxis:return n2(LX(i),"linear",e);case n.cartesianAxis:case n.cartesianTimeAxis:return n2(LX(i),void 0,e);case n.polarBandAxis:return s2(i.orient,"band",e);case n.polarLinearAxis:return s2(i.orient,"linear",e);case n.polarAxis:return s2(i.orient,void 0,e);case n.cartesianCrosshair:case n.polarCrosshair:return e.component?.crosshair;case n.colorLegend:return e.component?.colorLegend[O2(i)];case n.sizeLegend:return e.component?.sizeLegend[O2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),en(this._originalSpec)?this._spec=this._originalSpec.map((t=>xn({},this._theme,t))):this._spec=xn({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:O$.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const z2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(Xi(a)||Xi(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},H2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{Xi(i[e])||t.latestData.forEach((t=>{Cn(i[e]).forEach((i=>{Xi(t[i])||(Xi(o[t[i]])&&(o[t[i]]=0),Xi(n[e])||(o[t[i]]+=parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class j2 extends F2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else zl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),zl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=LX(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?$h.horizontal:$h.vertical)===$h.horizontal,Ki(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(Ki(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):Ki(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),Xi(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Nl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(Ki(t)&&(Ki(t.userId)&&(this._seriesUserId=Cn(t.userId)),Ki(t.specIndex)&&(this._seriesIndex=Cn(t.specIndex))),Ki(this._spec.seriesId)){const t=Cn(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(Ki(this._spec.seriesIndex)){const t=Cn(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(Ki(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Cn(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(Ki(this._spec.regionId)){const t=Cn(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(Nl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];let n=!1;if(this._relatedAxisComponent){const s={};zl(this._regions,(r=>{const a="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,o="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!a||!o)return;const l=a.getAxisId()===this._relatedAxisComponent.id?a:o.getAxisId()===this._relatedAxisComponent.id?o:this._isHorizontal?a:o,h=l===a?o:a,c=Nl(h.getScale(0).type);c&&(n=!0),t.push(r.getRawData());const d=r.getSpec(),u=Cn(d.xField),p=Cn(d.yField),g="cartesian"===r.coordinate?u[u.length-1]:d.angleField??d.categoryField,f="cartesian"===r.coordinate?p[p.length-1]:d.radiusField??d.valueField;if(s[r.id]="link"===r.type?"from_xField":l===a?g:f,e.push(s[r.id]),this._valueField){const t="link"===r.type?"from_yField":h===a?g:f;i.push(c?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else n=Xi(this._spec.valueField),zl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;JX(s,"dataview",Lo),ZX(s,"dataFilterComputeDomain",H2);const r=new jo(s);r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:n?this._valueField:null}}},!1),this._data=new zK(this._option,r),r.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&Nl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&Nl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Nl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new hh,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(ZX(this._option.dataSet,"dataFilterWithNewDomain",z2),zl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>Nl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Nl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=Kn(this._start-s,0,1),a=Kn(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}Mn(j2,O1);class N2 extends j2{static type=n.scrollBar;type=n.scrollBar;name=n.scrollBar;layoutZIndex=J$.DataZoom;layoutLevel=Q$.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(Xi(i))return;if(!en(i))return new N2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new N2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return rn(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return rn(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new eU({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(L$.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return Xi(i)||(n.padding=i),un(t?.style)||(n.railStyle=SX(t.style)),un(e?.style)||(n.sliderStyle=SX(e.style)),n}}class V2 extends j2{static type=n.dataZoom;type=n.dataZoom;name=n.dataZoom;layoutZIndex=J$.DataZoom;layoutLevel=Q$.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(Xi(i))return;if(!en(i))return new V2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new V2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize)}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new xh;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return rn(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return rn(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._stateScale:this._valueScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().x+e};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?this._valueScale:this._stateScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().y+e};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new _G({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(L$.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:SX(this._spec.background?.style),startHandlerStyle:SX(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:SX(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:SX(this._spec.middleHandler.background?.style)}},endHandlerStyle:SX(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:SX(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:SX(this._spec.endText?.style)},selectedBackgroundStyle:SX(this._spec.selectedBackground.style),dragMaskStyle:SX(this._spec.dragMask?.style),backgroundChartStyle:{line:xn(SX(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...SX(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:xn(SX(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...SX(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class W2 extends F2{static type=n.customMark;type=n.customMark;layoutType="absolute";layoutZIndex=J$.CustomMark;layoutLevel=Q$.CustomMark;static createComponent(t,e){return t.customMark?[new W2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Jj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Jj}_${n}`});if(s&&(Xi(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),Ki(t.dataId)||an(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class U2 extends F2{layoutType="absolute";static type=n.brush;type=n.brush;name=n.brush;layoutZIndex=J$.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!Xi(i)&&!1!==i.visible)return[new U2(i,{...e,specKey:U2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new fY({zIndex:this.layoutZIndex,brushStyle:SX(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=L$.brushChange;r="brushStart"===n||"brushDown"===n?L$.brushStart:"brushEnd"===n||"brushMaskUp"===n?L$.brushEnd:L$.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{...SX(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&vr(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&_r(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){Ki(this._spec.regionId)&&Ki(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Cn(this._spec.regionId),Cn(this._spec.regionIndex))}_bindLinkedSeries(){Ki(this._spec.brushLinkSeriesId)&&Ki(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Cn(this._spec.brushLinkSeriesId),Cn(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&Cn(t).includes(s.userId)||e&&Cn(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var G2;function Y2(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function $2(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function X2(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:$2(t.rect),anchorCandidates:t3(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>Y2(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;tY2(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function K2(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=mr(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=J2(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=Ya(r,n,i);if(!J2(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],q2(Z2(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=q2(Z2(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=Q2(t.rect,a,0),t}));return X2(h)}function q2(t){return t>180?t-360:t}function Z2(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function J2(t,e){for(let i=0;i{const{x:r,y:a}=Q2({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(G2||(G2={}));class e3 extends F2{static type=n.mapLabel;type=n.mapLabel;name=n.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=J$.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!Ki(i.series)?new e3(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new jo(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new zK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new RG({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=Qh(this._spec.background?.padding),c=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const d={},u=this.dataToPosition(t),p=hB({});if(p.name=`${this.name}_marker_itemContainer_${e}`,d.container=p,this._spec.background?.visible){const t=uB(SX({...this._spec.background.style}));t.setAttributes(u),d.labelBackground=t,p.appendChild(t)}if(this._spec.icon?.visible){const t=fB(SX({...this._spec.icon.style}));t.setAttributes(u),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;d.icon=t,p.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=gB(SX({...this._spec.nameLabel.style}));e.setAttributes(u),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;d.nameLabel=e,p.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&Ki(t[this.valueField])){const e=gB(SX({...this._spec.valueLabel.style}));e.setAttributes(u),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;d.valueLabel=e,p.appendChild(e),a=Math.max(a,s),r+=o,i++}const g=Object.values(d).find((t=>!!t&&"group"!==t.type)),f={x:g?.getComputedAttribute("x"),y:g?.getComputedAttribute("y")},m={x:f.x,y:f.y,width:0,height:0};m.width=n+r+(i-1)*c,m.height=s+a;const y={rect:m,point:f,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));y.rect=Q2(m,o,l),y.anchors=t,y.offset=l}else y.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:y,contentMarks:d}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:SX({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):X2(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class i3{id;name;service;static Name;constructor(t=i3.Name){this.id=Qo(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function n3(t,e){const i=e.getSpec?.();un(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=BX(e.layoutOrient),r=t[0],a=Tn(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);n3(n?n.getChildren():[],t.component),n3(s?s.getChildren():[],t.component)}}function r3(t){return 2===t.length&&an(t[0])&&an(t[1])&&t[1]>=t[0]}function a3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!an(a.min),extendable_max:!an(a.max)}}function o3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function l3(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function h3(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function c3(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const d3=(t,e)=>t.map(((t,i)=>({index:i,value:t,label:e.labelFormatter?e.labelFormatter(t):`${t}`}))),u3=(t,e,i=0)=>{const n=new Ts(t).expand(i/2),s=new Ts(e).expand(i/2);return n.intersects(s)},p3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function f3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=kl(-90));const u=pX(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Ts).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},y3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return d3(p,r.options)};class _3 extends i3{Name="AxisSyncPlugin";constructor(){super(_3.Name)}_checkEnableSync(t){if(!Nl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(L$.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!Nl(i.type)||!Nl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!r3(s)||!r3(r))return;const a=a3(t,s),o=a3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!l3(a,o))return}else if(0===p&&0===g){if(!l3(o,a))return}else if(u||y)if(u&&!y){if(!o3(a,o))return}else if(y&&!u){if(!o3(o,a))return}else{if(h===g)return;if(h>g){if(!h3(a,o))return}else if(!h3(o,a))return}else{if(0===h&&0===p){if(!c3(a,o))return}else if(0===g&&0===l&&!c3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){ZX(e.getOption().dataSet,"tickAlign",y3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var v3={AxisLabelOverlapPlugin:s3,AxisSyncPlugin:_3};const b3=t=>t,x3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!g3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},S3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?p3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return d3(t.domain(),e);let h;if(Ki(s))h=t.stepTicks(s);else if(Ki(n))h=t.forceTicks(n);else if(Ki(i))h=t.ticks(i);else{const i=t.domain(),n=t.range(),s=Q1(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=Q1(r),c=pX(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Ll(u),{x:m,y:y}=Is({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Ts).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=A3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}return d3(h,e)},A3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&u3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},k3=(t,e)=>{if(Nl(t.type))return((t,e)=>{if(!Nl(t.type))return d3(t.domain(),e);const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=Ki(s)?t.stepTicks(s):Ki(n)?t.forceTicks(n):t.ticks(i??5),"cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType){const{labelGap:i=4,labelFlush:n}=e;let s=m3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&f3(s,i);)s=x3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),Tn(a)!==Tn(r)&&a.push(Tn(r))),r=a}return d3(r,e)})(t,e);if(Wl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(Ki(s))l=t.stepTicks(s);else if(Ki(n))l=t.forceTicks(n);else if(Ki(i))l=t.ticks(i);else{const i=t.domain(),n=t.range(),s=m3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=S3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}return d3(l,e)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return w3(t,e)}return d3(t.domain(),e)};class M3 extends F2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),Ki(this._spec.id)&&t.setUserId(this._spec.id),Yi(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==pn(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=DZ(BZ.axis(),{appear:this._spec.animationAppear??pn(this._option.getChart().getSpec(),"animationAppear.axis")??pn(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??pn(this._option.getChart().getSpec(),"animationDisappear.axis")??pn(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??pn(this._option.getChart().getSpec(),"animationEnter.axis")??pn(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??pn(this._option.getChart().getSpec(),"animationExit.axis")??pn(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??pn(this._option.getChart().getSpec(),"animationUpdate.axis")??pn(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return zl(this._regions,(e=>{en(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;Ki(t)&&(this._seriesUserId=Cn(t)),Ki(i)&&(this._regionUserId=Cn(i)),Ki(e)&&(this._seriesIndex=Cn(e)),Ki(n)&&(this._regionIndex=Cn(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(zl(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!Nl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(zl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return en(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===JU.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&Xi(t.title.angle)&&(i="left"===t.orient?-90:90,e=J1[t.orient]),{select:t.select,hover:t.hover,line:(n=t.domainLine,bX(n),bX(n.startSymbol),bX(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:$i(t.label.style)?(e,i)=>{const n=this._preprocessSpec(t.label.style(e.rawValue,i,e));return SX(this._preprocessSpec(xn({},this._theme.label?.style,n)))}:SX(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:xX(t.label.state)},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:$i(t.tick.style)?(e,i)=>{const n=this._preprocessSpec(t.tick.style(e.rawValue,i,e));return SX(this._preprocessSpec(xn({},this._theme.tick?.style,n)))}:SX(t.tick.style),state:xX(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:SX(t.subTick.style),state:xX(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:$i(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return SX(this._preprocessSpec(xn({},this._theme.grid?.style,n)))}:SX(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:SX(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Es(i):null,textStyle:xn({},e,SX(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:SX(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:SX(t.title.background?.style)},state:{text:xX(t.title.state),shape:xX(t.title.shape?.state),background:xX(t.title.background?.state)}},panel:{visible:t.background?.visible,style:SX(t.background?.style),state:xX(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const C3=[v3.AxisLabelOverlapPlugin,v3.AxisSyncPlugin];class T3 extends M3{static type=n.cartesianAxis;type=n.cartesianAxis;name=n.cartesianAxis;layoutType="region-relative";layoutZIndex=J$.Axis;layoutLevel=Q$.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;constructor(t,e){super(t,{...e}),this._orient=LX(t,["z"]),DX(this._orient)&&(this.layoutType="absolute"),Ki(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?BX(t)?"linear":"band":BX(t)?"band":"linear"}(t.orient,i),s=`${T3.type}-${n}`,r=AX.getComponentInKey(s);if(r){let n=t.inverse;return i&&!BX(t.orient)&&(n=!Ki(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(T3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[T3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===$h.horizontal;if(!en(i))return e2(i)?T3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>IX(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{e2(t)&&a.push(T3.createAxis(t,{...e,specIndex:i,specKey:T3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),zl(this._regions,(t=>{BX(this.orient)?t.setXAxisHelper(this.axisHelper()):IX(this.orient)?t.setYAxisHelper(this.axisHelper()):DX(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];BX(this.orient)?an(e)&&(s=n?[e,0]:[0,e]):DX(this.orient)?an(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):an(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(C3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=BX(this.orient)?t.fieldX:DX(this.orient)?t.fieldZ:t.fieldY,Nl(this._scale.type)?e:[e[0]]}_initData(){JX(this._option.dataSet,"scale",b3),ZX(this._option.dataSet,"ticks",k3);const t=this._spec.label||{},e=this._tick||{},i=new jo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new zK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(uV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(BX(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(L$.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return zl(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return zl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:BX(this.orient)?i.fieldX:DX(this.orient)?i.fieldZ:i.fieldY,n=en(n)?Nl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){zl(this._regions,(t=>{BX(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):IX(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):DX(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;an(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),an(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=BX(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(xn({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=xn({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&Xi(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=BX(this.orient),s=t=>(n?!BX(t.orient):BX(t.orient))&&Nl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(Ki(t))a=r.find((e=>e.id===t));else if(Ki(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const E3=Math.sqrt(50),R3=Math.sqrt(10),P3=Math.sqrt(2);class B3{_extend={};setExtraAttrFromSpec(){Ki(this._spec.nice)&&(this._nice=this._spec.nice),Ki(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=t2(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),Xi(this._domain?.min)&&Xi(this._domain?.max)?this._nice&&this._scale.nice(t):Ki(this._domain?.min)&&Xi(this._domain?.max)?this._nice&&this._scale.niceMax(t):Xi(this._domain?.min)&&Ki(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];Ki(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),Ki(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(En(t)-function(t){if(t&&en(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=E3?10:s>=R3?5:s>=P3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),Xi(this._domain?.min)&&Xi(this._domain?.max)?this._scale.nice(t):Ki(this._domain?.min)&&Xi(this._domain?.max)?this._scale.niceMax(t):Xi(this._domain?.min)&&Ki(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(L$.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}Mn(L3,D3);class O3 extends I3{static type=n.cartesianTimeAxis;type=n.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),zl(this._regions,(t=>{BX(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=xn({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new jo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new zK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=No.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return en(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&en(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class F3 extends M3{static type=n.polarAxis;type=n.polarAxis;name=n.polarAxis;layoutType="absolute";layoutZIndex=J$.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=AN;get startAngle(){return this._startAngle}_endAngle=kN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${F3.type}-${i}`,s=AX.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(F3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!en(i))return i2(i)?(i.center=t.center,i.startAngle=t.startAngle??MN,i.endAngle=t.endAngle??(Ki(t.startAngle)?t.startAngle+360:CN),F3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!i2(i))return;i.center=t.center,i.startAngle=t.startAngle??MN,i.endAngle=t.endAngle??(Ki(t.startAngle)?t.startAngle+360:CN),i.outerRadius=i.radius??t.outerRadius??t.radius??TN;const o=F3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),zl(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=kl(this._spec.startAngle??MN),this._endAngle=kl(this._spec.endAngle??(Ki(this._spec.startAngle)?this._spec.startAngle+360:CN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(L$.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){JX(this._option.dataSet,"scale",b3),ZX(this._option.dataSet,"ticks",k3);const t=this._spec.label||{},e=this._spec.tick||{},i=new jo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new zK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return zl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=en(n)?Nl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){zl(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return Nl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=Cl({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:en(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=ks.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:en(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=TN,e=0;const i=this.getChart().getSpec();return zl(this.getRegions(),(n=>{const s=n;if(function(t){return[GK.rose,GK.radar,GK.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;an(n)&&(t=n),an(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(xn({},this._axisStyle,t))}}class z3 extends F3{static type=n.polarLinearAxis;type=n.polarLinearAxis;_zero=!0;_nice=!0;_scale=new xh;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}Mn(z3,B3);class H3 extends F3{static type=n.polarBandAxis;type=n.polarBandAxis;_scale=new hh;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function j3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:c,data:d,filter:u,regionId:p,regionIndex:g,seriesIndex:f,seriesId:m,padding:y,..._}=xn({},t),v=_;return i.visible&&(v.title=L2(i)),un(n.focusIconStyle)||SX(n.focusIconStyle),bX(n.shape),bX(n.label),bX(n.value),bX(n.background),qh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),qh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),qh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),v.item=n,un(s.textStyle)||SX(s.textStyle),bX(s.handler),v.pager=s,r.visible&&!un(r.style)&&(xn(v,r.style),Ki(r.padding)&&(v.padding=r.padding)),v}Mn(H3,D3);const N3=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},V3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return Ki(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class W3 extends F2{layoutType="normal";layoutZIndex=J$.Legend;layoutLevel=Q$.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{zl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),zl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Xh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;Ki(i)&&(this._seriesUserId=Cn(i)),Ki(t)&&(this._regionUserId=Cn(t)),Ki(n)&&(this._seriesIndex=Cn(n)),Ki(e)&&(this._regionUserIndex=Cn(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new zK(this._option,t),this._initSelectedData(),zl(this._regions,(t=>{t.event.on(L$.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;Xi(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(L$.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;an(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)An(n,this._cacheAttrs)||this._legendComponent.setAttributes(xn({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(xn({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class U3 extends W3{static type=n.discreteLegend;type=n.discreteLegend;name=n.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!en(i))return i.type&&"discrete"!==i.type?void 0:new U3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new U3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),zl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){ZX(this._option.dataSet,"discreteLegendFilter",V3),ZX(this._option.dataSet,"discreteLegendDataMake",N3);const t=new jo(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!el(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&Xi(t.title.text)&&Xi(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=yX(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...j3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return VG}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(FG.legendItemClick,(e=>{const i=pn(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(L$.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(FG.legendItemHover,(t=>{const e=pn(t,"detail");this.event.emit(L$.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(FG.legendItemUnHover,(t=>{const e=pn(t,"detail");this.event.emit(L$.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:an(r)?r:1,strokeOpacity:an(a)?a:1,opacity:an(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return $i(this._spec.data)?this._spec.data(t):t}}const G3=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;an(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},Y3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!un(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function $3(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:c,id:d,visible:u,orient:p,position:g,data:f,defaultSelected:m,field:y,filter:_,regionId:v,regionIndex:b,seriesIndex:x,seriesId:S,padding:w,...A}=xn({},t),k=A;return e.visible&&(k.title=L2(e)),k.showHandler=!1!==i.visible,un(i.style)||(k.handlerStyle=SX(i.style)),Ki(n.width)&&(k.railWidth=n.width),Ki(n.height)&&(k.railHeight=n.height),un(n.style)||(k.railStyle=SX(n.style)),un(s.style)||(k.trackStyle=SX(s.style)),k.startText=bX(r),k.endText=bX(a),k.handlerText=bX(o),un(l)||(k.sizeBackground=SX(l)),h.visible&&!un(h.style)&&(xn(k,h.style),Ki(h.padding)&&(k.padding=h.padding)),k}function X3(t){return"color"===t||"size"===t}const K3={color:$G,size:KG},q3=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Z3=[2,10];class J3 extends W3{static type=n.continuousLegend;type=n.colorLegend;name=n.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!en(i))return X3(i.type)?new J3(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{X3(t.type)&&n.push(new J3(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?n.colorLegend:n.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),zl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){ZX(this._option.dataSet,"continuousLegendFilter",Y3),ZX(this._option.dataSet,"continuousLegendDataMake",G3);const t=new jo(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&Xi(t.title.text)&&Xi(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=yX(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!el(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=yX(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),un(n)&&(n="color"===this._legendType?q3:Z3);const r={...$3(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return K3[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",Qn((e=>{const i=pn(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(L$.legendFilter,{model:this,value:i,event:e})}),30))}}}const Q3=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),Cn(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class t5 extends F2{static type=n.indicator;type=n.indicator;name=n.indicator;layoutType="absolute";layoutZIndex=J$.Indicator;layoutLevel=Q$.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==t5.type)return null;const i=Cn(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map((t=>new t5(t,e)));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(Cn(this._spec.regionId),Cn(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){ZX(this._option.dataSet,"indicatorFilter",Q3);const t=new jo(this._option.dataSet);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 zK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return Cn(this._spec.content).forEach((t=>{const e=xn({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{...SX(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!Ki(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{...SX(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)An(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new JG(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":$i(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return zl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){super.clear(),this._indicatorComponent=null,this._cacheAttrs=null}}class e5 extends F2{static type=n.title;type=n.title;layoutType="normal";layoutZIndex=J$.Title;layoutLevel=Q$.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Xh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!en(i))return new e5(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new e5(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;an(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),an(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:an(t.width())?t.width():0,height:this._spec.height?this._spec.height:an(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)An(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new qG(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class i5{projection;constructor(t){if(this.projection=mJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function n5(t,e){return`${Jj}_${e}_${t}`}class s5 extends F2{static type=n.geoCoordinate;type=n.geoCoordinate;name=n.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:n5(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(Xi(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new s5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=xn(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(L$.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new i5(this._projectionSpec)}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===GK.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===GK.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(GK.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==GK.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}Mn(s5,O1);const r5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},a5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class o5 extends F2{layoutType="absolute";gridZIndex=J$.CrossHair_Grid;labelZIndex=J$.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();en(t)?t.forEach(((t,i)=>this._registerEvent(t,en(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:O$.chart},this._handleEvent),this.event.on(e,{level:F$.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ts((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(r5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(en(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(r5[e][t]),s=s.concat(r5[e][i(t)])})),{in:n,out:s}}return{in:r5[e][t],out:r5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=pn(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{a5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();en(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),en(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function h5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var c5,d5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(c5||(c5={}));class u5 extends o5{static type=n.cartesianCrosshair;type=n.cartesianCrosshair;name=n.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(Xi(i))return;if(!en(i))return i.xField||i.yField?new u5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new u5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,c5.VERTICAL,!0),this.layoutByValue(c5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,c5.HORIZONTAL,!1),this.layoutByValue(c5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return Nl(t.getScale().type)&&an(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){BX(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{Wl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(c5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=c5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,c;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(Wl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(Nl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=h5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=Q1(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(Wl(s.type)){const t=s._step;c=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(Nl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=h5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(c=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):c=1,a=r}}if(this.yHair.label?.visible){const e=Q1(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&Ki(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&Ki(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(c5.HORIZONTAL&&this._layoutHorizontal(n,c??0),c5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new SU({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new wU({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new bU(e)),n.add(t)),l5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(d5||(d5={}));class p5 extends o5{static type=n.polarCrosshair;type=n.polarCrosshair;name=n.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(Xi(i))return;if(!en(i))return i.categoryField||i.valueField?new p5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new p5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{Wl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});Nl(s.getScale().type)&&an(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:ks.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(d5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",xn(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=Q1(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=Q1(t.getSpec())),n.angle=i.angle,n.axis=t,xn(n,s)}))),this.enableRemain&&!i.visible&&Ki(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&Ki(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(d5.HORIZONTAL&&this._layoutHorizontal(n),d5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:Is(l,n,i),end:Is(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new SU({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new kU({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Ll(i),e={...Is(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Ds(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=Is(t,s,p),m=Is(t,s,g),y=sr([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=Kn(ks.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new MU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new AU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=Al(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}}(i),n={...Is(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new bU(e),n.add(t),i(t)),l5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const g5=t=>SX({...t}),f5=t=>({...t,style:{...SX(t.style)}}),m5=t=>{const e=g5(t?.slider?.trackStyle??{}),i=g5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},SX({...s}));var s;const r=f5(t?.controller?.start??{}),a=f5(t?.controller?.pause??{}),o=f5(t?.controller?.backward??{}),l=f5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},y5=(t,e)=>({...m5(t),data:e,type:"continuous"}),_5=(t,e)=>({...m5(t),data:e,type:"discrete"}),v5=t=>"left"===t||"right"===t,b5=t=>"top"===t||"bottom"===t;class x5 extends F2{layoutZIndex=J$.Player;layoutLevel=Q$.Player;static type=n.player;type=n.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return Xi(i)||!1===i.visible?null:new x5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),an(t.x)){const e=v5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(an(t.y)){const e=b5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(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}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{..._5(this._spec,this._specs),...e}:{...y5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?An(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new dY(t):this._playerComponent=new pY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 rn(this._spec.width)?Math.min(t.width,Number(this._spec.width)):v5(this._orient)?this._maxSize():t.width}_computeHeight(t){return rn(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):b5(this._orient)?this._maxSize():t.height}_computeDx(t){return v5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return b5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...Cn(this._spec.controller.start?.style?.size),...Cn(this._spec.controller.pause?.style?.size),...Cn(this._spec.controller.backward?.style?.size),...Cn(this._spec.controller.forward?.style?.size),(v5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(v5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...Cn(this._spec.controller.start?.style?.size),...Cn(this._spec.controller.pause?.style?.size),...Cn(this._spec.controller.backward?.style?.size),...Cn(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(L$.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(aY.OnEnd,(()=>{this.event.emit(L$.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(aY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];Cn(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(L$.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const S5=(t,e)=>Pl(t[0].latestData,e.field),w5=(t,e)=>Bl(t[0].latestData,e.field);function A5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return an(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function k5(t,e){return Il(t[0].latestData,e.field)}function M5(t,e){return Dl(t[0].latestData,e.field)}function C5(t,e){return function(t,e){return Math.sqrt(Dl(t,e))}(t[0].latestData,e.field)}function T5(t,e){return function(t,e){return Fn(t.map((t=>t[e])))}(t[0].latestData,e.field)}function E5(t,e){const i={min:S5,max:w5,sum:A5,average:k5,variance:M5,standardDeviation:C5,median:T5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(Ki(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(Ki(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function R5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],c=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,d=n.getXAxisHelper().getScale(0).domain();return c.forEach((t=>{if(Ki(t.x)){rn(t.x)&&I5(d,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function P5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],c=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,d=n.getYAxisHelper().getScale(0).domain();return c.forEach((t=>{if(Ki(t.y)){rn(t.y)&&I5(d,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function B5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();rn(t.x)&&I5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),rn(t.y)&&I5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function I5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const D5=["sum","average","min","max","variance","standardDeviation","median"];class L5 extends F2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||D5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??Cn(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(Cn(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Pl(t,e),r=Bl(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class F5 extends L5{static type=n.markLine;type=n.markLine;name=n.markLine;layoutZIndex=J$.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(Xi(i))return;if(!en(i)&&!1!==i.visible)return new F5(i,{...e,specKey:F5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new F5(t,{...e,specIndex:i,specKey:F5.speckey}))})),n}_createMarkerComponent(){const t=new TG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:SX(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:SX(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:SX(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...SX(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...SX(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:SX(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=Ki(t.x)||Ki(t.coordinates)&&Ki(t.process)&&Ki(t.process.x),a=Ki(t.y)||Ki(t.coordinates)&&Ki(t.process)&&Ki(t.process.y),o=Ki(t.coordinates)&&(!Ki(t.process)||"process"in t&&"xy"in t.process),l=Ki(t.positions),h=t?.autoRange??!1;let c=[];r?c=R5(e,i,n,s,h)[0]:a?c=P5(e,i,n,s,h)[0]:o?c=B5(e,s,h):l&&(c=t.positions),this._markerComponent?.setAttributes({points:c})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;ZX(this._option.dataSet,"markerAggregation",E5),ZX(this._option.dataSet,"markerRegression",O5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new jo(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new jo(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class z5 extends L5{static type=n.markArea;type=n.markArea;name=n.markArea;layoutZIndex=J$.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(Xi(i))return;if(!en(i)&&!1!==i.visible)return new z5(i,{...e,specKey:z5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new z5(t,{...e,specIndex:i,specKey:z5.speckey}))})),n}_createMarkerComponent(){const t=new EG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:SX(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...SX(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...SX(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:SX(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=Ki(t.x)&&Ki(t.x1),a=Ki(t.y)&&Ki(t.y1),o=Ki(t.coordinates),l=Ki(t.positions),h=t?.autoRange??!1;let c=[],d=[];r?(d=R5(e,i,n,s,h),c=[...d[0],d[1][1],d[1][0]]):a?(d=P5(e,i,n,s,h),c=[...d[0],d[1][1],d[1][0]]):o?c=B5(e,s,h):l&&(c=t.positions),this._markerComponent?.setAttributes({points:c})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=Ki(t.x)&&Ki(t.x1),n=Ki(t.y)&&Ki(t.y1),s=Ki(t.coordinates);if(!i&&!n&&!s)return null;let r;ZX(this._option.dataSet,"markerAggregation",E5),ZX(this._option.dataSet,"markerRegression",O5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new jo(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class H5 extends L5{static type=n.markPoint;type=n.markPoint;name=n.markPoint;layoutZIndex=J$.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(Xi(i))return;if(!en(i)&&!1!==i.visible)return new H5(i,{...e,specKey:H5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new H5(t,{...e,specIndex:i,specKey:H5.speckey}))})),n}_createMarkerComponent(){const t=new RG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:SX(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:SX(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{...SX(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{...SX(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:SX(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=B5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!Ki(t.coordinate))return;ZX(this._option.dataSet,"markerAggregation",E5);const i=this._processSpecCoo(t),n=new jo(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const j5=(t,e,i)=>Xi(t)?t:$i(t)?t(e,i):t,N5=(t,e,i)=>{if(Xi(t))return t;if(en(t)){const n=[];return t.forEach((t=>{if($i(t)){const s=t(e,i);Ki(s)&&n.push(s)}else n.push(t)})),n}return $i(t)?t(e,i):t};const V5="vchart-tooltip-container",W5=20,U5={key:"其他",value:"..."},G5={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class Y5{static dom=`${Jj}_TOOLTIP_HANDLER_DOM`;static canvas=`${Jj}_TOOLTIP_HANDLER_CANVAS`}const $5=(t,e,i)=>{const n=j5(e.key,t,i),s=j5(e.value,t,i),r=!1!==j5(e.visible,t,i)&&(Ki(n)||Ki(s)),a=j5(e.isKeyAdaptive,t,i),o=j5(e.shapeType,t,i),l=j5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},X5=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,K5=(t,e)=>{let i;if(Ki(t))if(rn(t))i=t;else if($i(t)){const n=t(e);rn(n)&&(i=n)}return i},q5=(t,e)=>{const i=pX(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function Z5(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Bj,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var J5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(J5||(J5={}));class Q5{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),J5.success):(this._updateTooltip(!1,e),J5.success)}if(Xi(n)||Xi(s))return J5.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(Ki(t.visible)||Ki(t.activeType)?s.visible=dq(t).includes("mark"):Ki(e.visible)||Ki(e.activeType)?s.visible=dq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=X5(i,"mark")??{},a=xn({},yn(e.mark),yn(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(Ki))),[]);if(t.every((t=>!dq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:Ki(e.visible)||Ki(e.activeType)?s.visible=dq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=X5(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{$i(t)?o.push(t):o.push(...Cn(t))})),r={...i[0],content:o};let l={};const h=t.filter((t=>{const e=t.tooltipHelper?.spec;return Ki(e?.dimension)&&dq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(h.length){let t=[];h.every((({content:t})=>Xi(t)))?t=void 0:h.forEach((({content:e})=>{Xi(e)||($i(e)?t?.push(e):t?.push(...Cn(e)))})),l={...h[0],content:t}}a=xn({},yn(e.dimension),l)}const o=r.title,l={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(Ki(a.title))if($i(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...l,...n}}}else a.title={...r.title,...l,...a.title};else a.title={...r.title,...l};const h=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),c=Cn(r.content);if(Ki(a.content))if($i(a.content)){const t=a.content;a.content=(e,i)=>{const n=Cn(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...h(c[0]),...t}})),n}}else{const t=Cn(a.content);t.forEach(((e,i)=>{t[i]={...h(c[0]),...e}}))}else a.content=c.map((t=>({...t,...h(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return J5.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??J5.success;const a=r[n];if(!a)return J5.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),Xi(o.title?.key)&&Xi(o.title?.value)&&!o.content?.length?J5.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??J5.success;const o=i[n];if(!o)return J5.failed;const l=this._getActualTooltipPosition(e,N5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),J5.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=rn(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ts(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...G5,offsetX:t?.x??G5.offsetX,offsetY:t?.y??G5.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=N5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=N5(t.title,e,i),s=Cn(N5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=W5}=t,o=!1!==j5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,Ki(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=j5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=$5(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...U5});break}if(!(r.content.lengthXi(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=$5(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...U5});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(Xi(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),Xi(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!Ki(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,c=this._component.getSpec(),d="canvas"===c.renderMode,u=i?.chart?.getCanvasRect(),p=u?.width??Qj,g=u?.height??tN;let f,m,y,_,v,b,x=!1;if(qi(e)){const{left:t,right:i,top:n,bottom:s}=e;f=K5(t,r),m=K5(n,r),y=K5(i,r),_=K5(s,r)}else if(Ki(e)&&"mark"===t.activeType){x=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case PX.left:f=t-a-l,m=(i+c)/2-o/2;break;case PX.right:f=n+l,m=(i+c)/2-o/2;break;case PX.top:f=(t+n)/2-a/2,m=i-o-h;break;case PX.bottom:f=(t+n)/2-a/2,m=c+h;break;case PX.inside:f=(t+n)/2-a/2,m=(i+c)/2-o/2}}}const S={width:0,height:0},w=(t=0)=>({x:t,y:t});let A=w(),k=w(),M=1,C=1;if(Ko(this._env)&&!c.confine){if(S.width=window.innerWidth,S.height=window.innerHeight,!d){const t=this._compiler.getCanvas()??this._chartContainer;k=n.getBoundingClientRect();const e=t.getBoundingClientRect();A={x:e.x-k.x,y:e.y-k.y},M=t4(t),C=t4(n)}}else S.width=p,S.height=g;const{canvasX:T,canvasY:E}=r;v=an(f)?f:an(y)?p-a-y:T+l,b=an(m)?m:an(_)?g-o-_:E+h,v*=M,b*=M,Ko(this._env)&&(v+=A.x,b+=A.y),v/=C,b/=C;const{width:R,height:P}=S;return(v+a)*C+k.x>R&&(x?v=(R-k.x)/C-a:v-=2*l+a),(b+o)*C+k.y>P&&(x?b=(P-k.y)/C-o:b-=2*h+o),v*C+k.x<0&&(v=0-k.x/C),b*C+k.y<0&&(b=0-k.y/C),{x:v,y:b}};_getTooltipBoxSize(t,e){return e&&!Xi(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:c=[]}=t;let d=0,u=n.top+n.bottom,p=0;const{visible:g=!0,value:f="",hasShape:m,shapeType:y="",shapeHollow:_,shapeColor:v}=h;if(l.title.visible=g,g){const{text:t,width:e,height:i}=q5(f,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},d=e,p=i,m&&YR[y]){const t={symbolType:y};_?t.stroke=v:t.fill=v,l.title.shape=t,d+=r.size+r.spacing,p=Math.max(r.size,p)}l.title.width=d,l.title.height=p,u+=p}if(c.length){const t=c.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){g&&(u+=i);let e=!1;const n=[],h=[],c=[];l.content=t.map(((l,d)=>{const p={height:0,spaceRow:i};let g=0;const{hasShape:f,key:m,shapeColor:y,shapeHollow:_,shapeType:v="",value:b,isKeyAdaptive:x}=l;if(Ki(m)){const{width:t,height:e,text:i}=q5(m,a);p.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},x?h.push(t):n.push(t),g=Math.max(g,e)}if(Ki(b)){const{width:t,height:e,text:i}=q5(b,o);p.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},c.push(t),g=Math.max(g,e)}if(f&&YR[v]){e=!0;const t={visible:!0,symbolType:v};_?t.stroke=y:t.fill=y,g=Math.max(r.size,g),p.shape=t}else p.shape={visible:!1};return p.height=g,u+=g,dt.offsetWidth>0?t.getBoundingClientRect().width/t.offsetWidth:t.getBoundingClientRect().height/t.offsetHeight,e4=(t,e)=>Ki(t)?en(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function i4(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=xn({},e,t),d={};return d.fontFamily=i,d.fontSize=e4(n),d.color=s,d.textAlign=r,d.lineHeight=e4(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=e4(c),d}function n4(t,e){if(!t)return;const{size:i}=xn({},e,t),n={};return n.width=e4(i),n}class s4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===s4.type}type=s4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return s4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=Xo?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(s4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const r4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},a4={boxSizing:"border-box"},o4={display:"flex",whiteSpace:"nowrap"},l4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},h4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},c4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},d4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},u4={lineHeight:"normal"};class p4 extends s4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!YR[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=YR[e].pathStr;let o="currentColor";if(!n||tn(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(qi(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class g4 extends s4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class f4 extends s4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=Dn(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=Dn(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(xn({},l4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=xn({},a?c4:h4,{height:e4(i[n].height),...t.keyColumn.item});tn(r)&&""!==r?.trim?.()||rn(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=xn({},d4,{height:e4(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=xn({},u4,{height:e4(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=tn(s)&&""!==s?.trim?.()||rn(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=tn(s)&&""!==s?.trim?.()||rn(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class m4 extends s4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new f4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new f4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new f4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(xn({},o4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class y4 extends s4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new p4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new g4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(xn({},r4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class _4 extends s4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&Ki(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new y4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new m4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(xn({},a4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class v4 extends Q5{type=Y5.dom;_tooltipContainer=Xo?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(Xo&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:c,lineWidth:d=0},padding:u,key:p,value:g,title:f,shape:m,enterable:y,spaceRow:_,transitionDuration:v}=t,b=i,x={panel:{width:e4((e?.panel?.width??0)+2*d),height:e4((e?.panel?.height??0)+2*d),paddingBottom:e4(u.bottom),paddingLeft:e4(u.left),paddingRight:e4(u.right),paddingTop:e4(u.top),borderColor:c,borderWidth:e4(d),borderRadius:e4(h),backgroundColor:b?`${b}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:y?"auto":"none",transitionDuration:v?`${v}ms`:"initial",transitionProperty:v?"transform":"initial",transitionTimingFunction:v?"ease-out":"initial"},title:i4(f),content:{},shapeColumn:{item:n4(m),width:e4(m.size),marginRight:e4(m.spacing??8)},keyColumn:{item:i4(p),width:e4(e?.keyWidth),marginRight:e4(p.spacing??26)},valueColumn:{item:i4(g),width:e4(e?.valueWidth),marginRight:e4(g.spacing??0)},spaceRow:e4(_)};if(Ki(_)){const t=_/2;[x.shapeColumn.item,x.keyColumn.item,x.valueColumn.item].forEach((e=>{e.marginTop=e4(t),e.marginBottom=e.marginTop})),x.content.marginTop=e4(-t),x.content.marginBottom=x.content.marginTop}else[x.content,x.shapeColumn.item,x.keyColumn.item,x.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return x}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class b4 extends Q5{type=Y5.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new bY({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}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?Ki(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class x4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&Ki(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??J5.success:J5.failed}class S4 extends x4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(Xi(i))return!1;if(![Y5.dom,Y5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!uq(t)&&!Xi(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...HX(r,a)??[],...WX(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(Ki(i))break}return Ki(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class w4 extends x4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(Xi(i))return!1;if(![Y5.dom,Y5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const A4=t=>Ki(t)&&!en(t),k4=t=>Ki(t)&&en(t);class M4 extends F2{static type=n.tooltip;type=n.tooltip;name=n.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!en(i))return new M4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new M4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?b4:v4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new w4(this),dimension:new S4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:F$.chart},this._handleMouseMove),(qo(e)||Zo(e))&&(this._mountEvent("pointerdown",{level:F$.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:F$.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;Ko(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||uq(t)||(n&&A4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&k4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):Ki(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!Xi(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&fK.globalConfig.uniqueTooltip&&fK.hideTooltip(a.id),r};_getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=xn({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!Ki(t.visible)||t.visible,activeType:dq(t),renderMode:"html",trigger:Ki(t.trigger)?t.trigger:"hover",className:Ki(t.className)?t.className:"vchart-tooltip-element",enterable:!!Ki(t.enterable)&&t.enterable,transitionDuration:Ki(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=Ki(t.triggerOff)?t.triggerOff:this._spec.trigger,Ki(t.renderMode)?this._spec.renderMode=t.renderMode:Zo(this._option.mode)&&(this._spec.renderMode="canvas"),Ki(t.mark)&&(this._spec.mark={...yn(t.mark),activeType:"mark"}),Ki(t.dimension)&&(this._spec.dimension={...yn(t.dimension),activeType:"dimension"}),Ki(t.parentElement)?tn(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Ko(this._option.mode)&&(this._spec.parentElement=Xo?.body),Ki(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=cq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:O$.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(Xi(this._cacheInfo)||Xi(t))return!1;if(k4(t)){if(A4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>MX(t,e[i])))}if(k4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(Ki(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(Ki(n)&&Ki(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function C4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function T4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const E4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??C4(e)};let o=!1;return tn(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??T4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class R4 extends F2{static type=n.label;type=n.label;name=n.label;layoutType="absolute";layoutZIndex=J$.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new R4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(L$.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(uV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(uV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),zl(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:wX.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:wX.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=E4[s.type]??E4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return xn({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class P4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(an(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:$i(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&Ki(t.modelId)){if(Ki(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&Ki(t.modelKey)&&"modelIndex"in t&&Ki(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>B4(t))),a=s.filter((t=>!B4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>B4(t))),h=o.filter((t=>!B4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);an(o.width)||(o.width=a.width),an(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function B4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class I4 extends DK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&BX(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&IX(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}fK.useChart([W1,u2,U1,G1,M2,p2,f2,m2,A2,b2,X1,C2,c2,d2,y2,B2,I2,q1,Z1,_2,S2,w2,T2,$1,E2,R2,Y1,k2,o2,x2,l2]),fK.useComponent([I3,L3,O3,H3,z3,U3,J3,M4,u5,p5,V2,N2,t5,s5,F5,e5,z5,x5,R4,H5,U2,W2,e3]),AX.registerLayout("grid",P4),AX.registerLayout("layout3d",I4),t.Arc3dMark=NJ,t.ArcMark=zJ,t.AreaChart=W1,t.AreaMark=cJ,t.AreaSeries=dJ,t.Bar3dChart=G1,t.Bar3dSeries=rJ,t.BarChart=U1,t.BarSeries=VZ,t.BaseChart=KK,t.BaseMark=NK,t.BaseSeries=Mq,t.BoxPlotChart=Y1,t.BoxPlotMark=KZ,t.BoxPlotSeries=JZ,t.Brush=U2,t.CartesianAxis=T3,t.CartesianBandAxis=L3,t.CartesianChart=qK,t.CartesianCrossHair=u5,t.CartesianLinearAxis=I3,t.CartesianSeries=Cq,t.CartesianTimeAxis=O3,t.CellMark=N1,t.CirclePackingChart=$1,t.CirclePackingSeries=v1,t.CircularProgressChart=y2,t.CircularProgressSeries=aQ,t.CommonChart=X1,t.ComponentMark=WK,t.ContinuousLegend=J3,t.CustomMark=W2,t.DataZoom=V2,t.DiscreteLegend=U3,t.DotSeries=eQ,t.Factory=AX,t.Funnel3dChart=Z1,t.Funnel3dSeries=B0,t.FunnelChart=q1,t.FunnelSeries=R0,t.GaugeChart=o2,t.GaugePointerSeries=z1,t.GaugeSeries=H1,t.GeoCoordinate=s5,t.GridLayout=P4,t.GroupMark=VK,t.HeatmapChart=l2,t.HeatmapSeries=V1,t.Histogram3dChart=d2,t.HistogramChart=c2,t.Indicator=t5,t.Label=R4,t.Layout=DK,t.Layout3d=I4,t.LineChart=u2,t.LineMark=iJ,t.LineSeries=nJ,t.LinearProgressChart=_2,t.LinearProgressSeries=lQ,t.LinkPathMark=P1,t.LinkSeries=nQ,t.MapChart=p2,t.MapLabelComponent=e3,t.MapSeries=PJ,t.MarkArea=z5,t.MarkLine=F5,t.MarkPoint=H5,t.PathMark=CJ,t.Pie3dChart=m2,t.Pie3dSeries=VJ,t.PieChart=f2,t.PieSeries=jJ,t.Player=x5,t.PolarAxis=F3,t.PolarBandAxis=H3,t.PolarChart=r2,t.PolarCrossHair=p5,t.PolarLinearAxis=z3,t.PolarSeries=BJ,t.PolygonMark=E0,t.ProgressArcMark=rQ,t.ProgressLikeChart=a2,t.ProgressLikeSeries=sQ,t.Pyramid3dMark=P0,t.RadarChart=b2,t.RadarSeries=ZJ,t.RangeAreaChart=x2,t.RangeAreaSeries=pJ,t.RangeColumn3dChart=w2,t.RangeColumn3dSeries=hJ,t.RangeColumnChart=S2,t.RangeColumnSeries=lJ,t.Rect3dMark=sJ,t.RectMark=jZ,t.RoseChart=A2,t.RoseLikeChart=v2,t.RoseLikeSeries=KJ,t.RoseSeries=qJ,t.RuleMark=WZ,t.SankeyChart=k2,t.SankeySeries=B1,t.ScatterChart=M2,t.ScatterSeries=XJ,t.ScrollBar=N2,t.SequenceChart=C2,t.SunburstChart=T2,t.SunburstSeries=m1,t.SymbolMark=ZZ,t.TextMark=NZ,t.ThemeManager=uX,t.Title=e5,t.Tooltip=M4,t.TreeMapChart=E2,t.TreeMapSeries=F1,t.VChart=fK,t.WaterfallChart=R2,t.WaterfallSeries=UZ,t.WordCloud3dChart=I2,t.WordCloud3dSeries=p0,t.WordCloudChart=B2,t.WordCloudSeries=u0,t.default=fK,t.version="1.1.0-beta.8",Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var s={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);sObject.prototype.toString.call(t)===`[object ${e}]`,o=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||a(t,"Boolean")},l=t=>"function"==typeof t,h=t=>null==t,c=t=>null!=t,d=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},u=t=>"object"==typeof t&&null!==t,p=function(t){if(!u(t)||!a(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},g=t=>void 0===t,f=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||a(t,"String")},m=t=>Array.isArray?Array.isArray(t):a(t,"Array"),y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},_=t=>a(t,"Date"),v=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||a(t,"Number")},b=t=>v(t)&&Number.isFinite(t),x=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),S=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),w=Object.prototype,A=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)},k=Object.prototype.hasOwnProperty;function M(t){if(h(t))return!0;if(y(t))return!t.length;const e=S(t);if("Map"===e||"Set"===e)return!t.size;if(A(t))return!Object.keys(t).length;for(const e in t)if(k.call(t,e))return!1;return!0}const C=(t,e,i)=>{const n=f(e)?e.split("."):e;for(let e=0;enull!=t&&T.call(t,e);function P(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,o){if(null===i)return null;if(0===o)return i;let l;if("object"!=typeof i)return i;if(m(i)?l=[]:a(i,"RegExp")?(l=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(l.lastIndex=i.lastIndex)):l=_(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(l)}for(const e in i)l[e]=t(i[e],o-1);return l}(t,i)}function R(t){let e;if(!c(t)||"object"!=typeof t)return t;const i=m(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:o(t)||v(t)||f(t)?t:_(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=R(n)}return e}function B(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(c(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];c(n[r])&&"object"==typeof n[r]?I(t,e,r,i):D(t,r,n[r])}}}}function I(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(m(r)){if(n)a=[];else if(m(s))a=s;else if(y(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!z(t[i],e[i]))return!1;return!0}if(!p(t))return!1;const i=F(t),n=F(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!z(t[s],e[s]))return!1}return!0}function H(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function U(t,e){if(!m(t)||!m(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Y(t,e,i){c(e)||(e=t,t=0),c(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function $(t){return Number(t)}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function q(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(h(n)&&(n=t.length);i>>1;X(t[s],e)>0?n=s:i=s+1}return i}const Z=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(X)),K(i,.5)},J=Math.sqrt(50),Q=Math.sqrt(10),et=Math.sqrt(2);function it(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=J?s*=10:r>=Q?s*=5:r>=et&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:nt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function at(t,e,i,n){return t>e&&!rt(t,e,i,n)}function ot(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},ht=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?lt(n,r)+s:"center"===i?lt(n,Math.floor(r/2))+s+lt(n,Math.ceil(r/2)):s+lt(n,r)},ct=function(t,e,i){return ti?i:t},dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,p=!0;const g=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function y(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function _(){const t=Date.now();if(y(t))return v(t);o=m(_,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function v(t){return o=void 0,p&&n?f(t):(n=s=void 0,a)}function x(){const t=Date.now(),i=y(t);for(var r=arguments.length,d=new Array(r),p=0;pt*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const _t=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vt=new RegExp(_t.source,"g");const bt=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function xt(t){if(t instanceof Date)return t;if(f(t)){const e=bt.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return h(t)?new Date(NaN):new Date(Math.round(t))}const St=1e-12,wt=Math.PI,At=wt/2,kt=2*wt,Mt=2*Math.PI,Ct=Math.abs,Tt=Math.atan2,Et=Math.cos,Pt=Math.max,Rt=Math.min,Bt=Math.sin,It=Math.sqrt,Dt=Math.pow;function Lt(t){return t>1?0:t<-1?wt:Math.acos(t)}function Ot(t){return t>=1?At:t<=-1?-At:Math.asin(t)}function Ft(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function zt(t,e){return t[0]*e[1]-t[1]*e[0]}class Ht{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ht(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return v(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return v(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class jt{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Ht((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return m(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Nt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class Wt extends Vt{}function Ut(t){return t*(Math.PI/180)}function Gt(t){return 180*t/Math.PI}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-kt;)t+=kt;else if(t>0)for(;t>kt;)t-=kt;return t},Xt=Yt;function $t(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Kt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new qt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new qt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new qt(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=Gt(r.rotateDeg),r}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return v(t)?new re(t>>16,t>>8&255,255&t,1):m(t)?new re(t[0],t[1],t[2]):new re(255,255,255)}let se=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(c(te[t]))return function(t){return v(t)?new re(t>>>24,t>>>16&255,t>>>8&255,255&t):m(t)?new re(t[0],t[1],t[2],t[3]):new re(255,255,255,1)}(te[t]);if(c(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new re((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new re(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new re(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new re(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new re(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=Zt(h(t)?s.h:ct(t,0,360),h(e)?s.s:e>=0&&e<=1?100*e:e,h(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new re(r.r,r.g,r.b,n),this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}};class re{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),c(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ae(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new re(e,c,d,l*(1-t)+h*t)}},rgbToHex:oe,rgbToHsl:Jt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ye;function _e(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}var be;function xe(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me]),ce>fe||deye||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function Ae(t){return t/180*Math.PI}function ke(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?t.angle:Ae(t.angle),n=ke(t);return[we({x:t.x1,y:t.y1},i,n),we({x:t.x2,y:t.y1},i,n),we({x:t.x2,y:t.y2},i,n),we({x:t.x1,y:t.y2},i,n)]}let Ce,Te,Ee,Pe;function Re(t){return Ce=1/0,Te=1/0,Ee=-1/0,Pe=-1/0,t.forEach((t=>{Ce>t.x&&(Ce=t.x),Eet.y&&(Te=t.y),Pee&&r>n||rs?o:0}function Oe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class ze{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),c(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=c(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(h(this._canvas)&&(c(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),h(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&c(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),h(this._context)&&c(this._canvas)){const t=this._canvas.getContext("2d");c(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!h(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(h(t))return{width:0,height:0};if(h(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let c;try{const h=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});c={width:h.width(),height:h.height()}}catch(e){this._notSupportVRender=!0,c=this.measureWithNaiveCanvas(t)}return c}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(h(this._numberCharSize)){const t=this._standardMethod(ze.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ze.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return h(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ze.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(h(this._letterCharSize)){const t=this._standardMethod(ze.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ze.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return c(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){c(this._canvas)&&(this._canvas=null),c(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}ze.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ze.NUMBERS_CHAR_SET="0123456789",ze.FULL_SIZE_CHAR="字";const He="undefined"!=typeof console;function je(t,e,i){const n=[e].concat([].slice.call(i));He&&console[t].apply(console,n)}var Ne;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(Ne||(Ne={}));class Ve{static getInstance(t,e){return Ve._instance&&v(t)?Ve._instance.level(t):Ve._instance||(Ve._instance=new Ve(t,e)),Ve._instance}static setInstance(t){return Ve._instance=t}static setInstanceLevel(t){Ve._instance?Ve._instance.level(t):Ve._instance=new Ve(t)}static clearInstance(){Ve._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ne.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Ne.Info}canLogDebug(){return this._level>=Ne.Debug}canLogError(){return this._level>=Ne.Error}canLogWarn(){return this._level>=Ne.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Ne.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):je(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Ne.Warn&&je(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Ne.Info&&je(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Ne.Debug&&je(this._method||"log","DEBUG",e),this}}function We(t){if(b(t))return[t,t,t,t];if(m(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(d(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Ue(t){return t?"getUTCFullYear":"getFullYear"}function Ge(t){return t?"getUTCMonth":"getMonth"}function Ye(t){return t?"getUTCDate":"getDate"}function Xe(t){return t?"getUTCHours":"getHours"}function $e(t){return t?"getUTCMinutes":"getMinutes"}function Ke(t){return t?"getUTCSeconds":"getSeconds"}function qe(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Ze(t){return t?"setUTCFullYear":"setFullYear"}Ve._instance=null;const Je=1e3,Qe=6e4,ti=36e5,ei=24*ti,ii=31*ei,ni=365*ei,si=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),ri=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),ai=(t,e)=>e.getFullYear()-t.getFullYear(),oi=t=>t.getFullYear(),li=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),hi=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),ci=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),di=t=>t.getUTCFullYear(),ui=t=>(t.setDate(1),t.setHours(0,0,0,0),t),pi=(t,e)=>(t.setMonth(t.getMonth()+e),t),gi=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),fi=t=>t.getMonth(),mi=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),yi=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),_i=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),vi=t=>t.getUTCMonth(),bi=t=>(t.setHours(0,0,0,0),t),xi=(t,e)=>(t.setDate(t.getDate()+e),t),Si=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ei,wi=t=>t.getDate()-1,Ai=t=>(t.setUTCHours(0,0,0,0),t),ki=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Mi=(t,e)=>(+e-+t)/ei,Ci=t=>t.getUTCDate()-1,Ti=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),Ei=(t,e)=>(t.setHours(t.getHours()+e),t),Pi=(t,e)=>(+e-+t)/ti,Ri=t=>t.getHours(),Bi=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),Ii=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Di=t=>t.getUTCHours(),Li=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),Oi=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Fi=(t,e)=>(+e-+t)/6e4,zi=t=>t.getMinutes(),Hi=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),ji=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Ni=t=>t.getUTCMinutes(),Vi=t=>(t.setTime(+t-t.getMilliseconds()),t),Wi=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ui=(t,e)=>(+e-+t)/1e3,Gi=t=>t.getSeconds(),Yi=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),Xi=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),$i=t=>t.getUTCSeconds(),Ki=t=>t,qi=(t,e)=>(t.setTime(+t+e),t),Zi=(t,e)=>+e-+t,Ji=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},Qi=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Ji(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Ji(h,c)}};function tn(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function en(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var nn=6371008.8,sn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*nn,kilometers:6371.0088,kilometres:6371.0088,meters:nn,metres:nn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:nn/1852,radians:1,yards:6967335.223679999};function rn(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function an(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function on(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ln(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Ut(t[0]),r=Ut(t[1]),a=Ut(i),o=function(t,e){void 0===e&&(e="kilometers");var i=sn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Gt(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Gt(l)}}const hn=t=>t;var cn,dn;t.RenderModeEnum=void 0,(cn=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",cn["mobile-browser"]="mobile-browser",cn.node="node",cn.worker="worker",cn.miniApp="miniApp",cn["desktop-miniApp"]="desktop-miniApp",cn.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.customMark="customMark"}(dn||(dn={}));for(let t=0;t<256;t++)t.toString(16);const un=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};function pn(){return new gn}function gn(){this.reset()}gn.prototype={constructor:gn,reset:function(){this.s=this.t=0},add:function(t){mn(fn,t,this.t),mn(this,fn.s,this.s),this.s?this.t+=fn.t:this.s=fn.t},valueOf:function(){return this.s}};var fn=new gn;function mn(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var yn=1e-6,_n=Math.PI,vn=_n/2,bn=_n/4,xn=2*_n,Sn=180/_n,wn=_n/180,An=Math.abs,kn=Math.atan,Mn=Math.atan2,Cn=Math.cos,Tn=Math.exp,En=Math.log,Pn=Math.pow,Rn=Math.sin,Bn=Math.sign||function(t){return t>0?1:t<0?-1:0},In=Math.sqrt,Dn=Math.tan;function Ln(t){return t>1?0:t<-1?_n:Math.acos(t)}function On(t){return t>1?vn:t<-1?-vn:Math.asin(t)}function Fn(){}function zn(t,e){t&&jn.hasOwnProperty(t.type)&&jn[t.type](t,e)}var Hn={Feature:function(t,e){zn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++n_n?t+Math.round(-t/xn)*xn:t,e]}function Qn(t,e,i){return(t%=xn)?e||i?Zn(es(t),is(e,i)):es(t):e||i?is(e,i):Jn}function ts(t){return function(e,i){return[(e+=t)>_n?e-xn:e<-_n?e+xn:e,i]}}function es(t){var e=ts(t);return e.invert=ts(-t),e}function is(t,e){var i=Cn(t),n=Rn(t),s=Cn(e),r=Rn(e);function a(t,e){var a=Cn(e),o=Cn(t)*a,l=Rn(t)*a,h=Rn(e),c=h*i+o*n;return[Mn(l*s-c*r,o*i-h*n),On(c*s+l*r)]}return a.invert=function(t,e){var a=Cn(e),o=Cn(t)*a,l=Rn(t)*a,h=Rn(e),c=h*s-l*r;return[Mn(l*s+h*r,o*i+c*n),On(c*i-o*n)]},a}function ns(t,e){(e=Gn(e))[0]-=t,qn(e);var i=Ln(-e[1]);return((-e[2]<0?-i:i)+xn-yn)%xn}function ss(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:Fn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function rs(t,e){return An(t[0]-e[0])=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function ls(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function us(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function ps(t,e,i,n){return function(s){var r,a,o,l=e(s),h=ss(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=y,u.lineStart=_,u.lineEnd=v,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=us(a);var t=function(t,e){var i=cs(e),n=e[1],s=Rn(n),r=[Rn(i),-Cn(i),0],a=0,o=0;hs.reset(),1===s?n=vn+yn:-1===s&&(n=-vn-yn);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>_n,C=f*x;if(hs.add(Mn(C*A*Rn(k),m*S+C*Cn(k))),a+=M?w+A*xn:w,M^p>=i^v>=i){var T=Xn(Gn(u),Gn(_));qn(T);var E=Xn(r,T);qn(E);var P=(M^w>=0?-1:1)*On(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-yn||a0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(gs))}return u}}function gs(t){return t.length>1}function fs(t,e){return((t=t.x)[0]<0?t[1]-vn-yn:vn-t[1])-((e=e.x)[0]<0?e[1]-vn-yn:vn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return ds(e(t),i)})}(ds);var ms=ps((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?_n:-_n,l=An(r-i);An(l-_n)0?vn:-vn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=_n&&(An(i-s)yn?kn((Rn(e)*(r=Cn(n))*Rn(i)-Rn(n)*(s=Cn(e))*Rn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*vn,n.point(-_n,s),n.point(0,s),n.point(_n,s),n.point(_n,0),n.point(_n,-s),n.point(0,-s),n.point(-_n,-s),n.point(-_n,0),n.point(-_n,s);else if(An(t[0]-e[0])>yn){var r=t[0]0,s=An(e)>yn;function r(t,i){return Cn(t)*Cn(i)>e}function a(t,i,n){var s=[1,0,0],r=Xn(Gn(t),Gn(i)),a=Yn(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=Xn(s,r),u=Kn(s,h);$n(u,Kn(r,c));var p=d,g=Yn(u,p),f=Yn(p,p),m=g*g-f*(Yn(u,u)-1);if(!(m<0)){var y=In(m),_=Kn(p,(-g-y)/f);if($n(_,u),_=Un(_),!n)return _;var v,b=t[0],x=i[0],S=t[1],w=i[1];x0^_[1]<(An(_[0]-b)_n^(b<=_[0]&&_[0]<=x)){var M=Kn(p,(-g+y)/f);return $n(M,u),[_,Un(M)]}}}function o(e,i){var s=n?t:_n-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return ps(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=n?f?0:o(d,u):f?o(d+(d<0?_n:-_n),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||rs(e,p)||rs(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(s&&e&&n^f){var y;m&i||!(y=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!f||e&&rs(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Cn(e),o=Rn(e),l=n*i;null==s?(s=e+n*xn,r=e-l/2):(s=ns(a,s),r=ns(a,r),(n>0?sr)&&(s+=n*xn));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return An(n[0]-t)0?0:3:An(n[0]-i)0?2:1:An(n[1]-e)0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,y,_,v=a,b=ss(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);y=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,s=(l=us(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&os(l,o,e,r,a),a.polygonEnd());v=a,l=h=c=null}};function S(t,e){s(t,e)&&v.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),y)d=r,u=a,p=o,y=!1,o&&(v.lineStart(),v.point(r,a));else if(o&&m)v.point(r,a);else{var l=[g=Math.max(vs,Math.min(_s,g)),f=Math.max(vs,Math.min(_s,f))],b=[r=Math.max(vs,Math.min(_s,r)),a=Math.max(vs,Math.min(_s,a))];!function(t,e,i,n,s,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=s-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,n)?o&&(v.lineStart(),v.point(r,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),o||v.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function xs(t){return t}var Ss,ws,As,ks,Ms=pn(),Cs=pn(),Ts={point:Fn,lineStart:Fn,lineEnd:Fn,polygonStart:function(){Ts.lineStart=Es,Ts.lineEnd=Bs},polygonEnd:function(){Ts.lineStart=Ts.lineEnd=Ts.point=Fn,Ms.add(An(Cs)),Cs.reset()},result:function(){var t=Ms/2;return Ms.reset(),t}};function Es(){Ts.point=Ps}function Ps(t,e){Ts.point=Rs,Ss=As=t,ws=ks=e}function Rs(t,e){Cs.add(ks*t-As*e),As=t,ks=e}function Bs(){Rs(Ss,ws)}var Is=Ts,Ds=1/0,Ls=Ds,Os=-Ds,Fs=Os,zs={point:function(t,e){tOs&&(Os=t);eFs&&(Fs=e)},lineStart:Fn,lineEnd:Fn,polygonStart:Fn,polygonEnd:Fn,result:function(){var t=[[Ds,Ls],[Os,Fs]];return Os=Fs=-(Ls=Ds=1/0),t}};var Hs,js,Ns,Vs,Ws=zs,Us=0,Gs=0,Ys=0,Xs=0,$s=0,Ks=0,qs=0,Zs=0,Js=0,Qs={point:tr,lineStart:er,lineEnd:sr,polygonStart:function(){Qs.lineStart=rr,Qs.lineEnd=ar},polygonEnd:function(){Qs.point=tr,Qs.lineStart=er,Qs.lineEnd=sr},result:function(){var t=Js?[qs/Js,Zs/Js]:Ks?[Xs/Ks,$s/Ks]:Ys?[Us/Ys,Gs/Ys]:[NaN,NaN];return Us=Gs=Ys=Xs=$s=Ks=qs=Zs=Js=0,t}};function tr(t,e){Us+=t,Gs+=e,++Ys}function er(){Qs.point=ir}function ir(t,e){Qs.point=nr,tr(Ns=t,Vs=e)}function nr(t,e){var i=t-Ns,n=e-Vs,s=In(i*i+n*n);Xs+=s*(Ns+t)/2,$s+=s*(Vs+e)/2,Ks+=s,tr(Ns=t,Vs=e)}function sr(){Qs.point=tr}function rr(){Qs.point=or}function ar(){lr(Hs,js)}function or(t,e){Qs.point=lr,tr(Hs=Ns=t,js=Vs=e)}function lr(t,e){var i=t-Ns,n=e-Vs,s=In(i*i+n*n);Xs+=s*(Ns+t)/2,$s+=s*(Vs+e)/2,Ks+=s,qs+=(s=Vs*t-Ns*e)*(Ns+t),Zs+=s*(Vs+e),Js+=3*s,tr(Ns=t,Vs=e)}var hr=Qs;function cr(t){this._context=t}cr.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,xn)}},result:Fn};var dr,ur,pr,gr,fr,mr=pn(),yr={point:Fn,lineStart:function(){yr.point=_r},lineEnd:function(){dr&&vr(ur,pr),yr.point=Fn},polygonStart:function(){dr=!0},polygonEnd:function(){dr=null},result:function(){var t=+mr;return mr.reset(),t}};function _r(t,e){yr.point=vr,ur=gr=t,pr=fr=e}function vr(t,e){gr-=t,fr-=e,mr.add(In(gr*gr+fr*fr)),gr=t,fr=e}var br=yr;function xr(){this._string=[]}function Sr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function wr(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Wn(t,i(n))),n.result()}return r.area=function(t){return Wn(t,i(Is)),Is.result()},r.measure=function(t){return Wn(t,i(br)),br.result()},r.bounds=function(t){return Wn(t,i(Ws)),Ws.result()},r.centroid=function(t){return Wn(t,i(hr)),hr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new xr):new cr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function Ar(t){return function(e){var i=new kr;for(var n in t)i[n]=t[n];return i.stream=e,i}}function kr(){}function Mr(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Wn(i,t.stream(Ws)),e(Ws.result()),null!=n&&t.clipExtent(n),t}function Cr(t,e,i){return Mr(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Tr(t,e,i){return Cr(t,[[0,0],e],i)}function Er(t,e,i){return Mr(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Pr(t,e,i){return Mr(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}xr.prototype={_radius:4.5,_circle:Sr(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Sr(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},kr.prototype={constructor:kr,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Rr=16,Br=Cn(30*wn);function Ir(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,m){var y=h-n,_=c-s,v=y*y+_*_;if(v>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=In(b*b+x*x+S*S),A=On(S/=w),k=An(An(S)-1)e||An((y*E+_*P)/v-.5)>.3||a*u+o*p+l*g2?t[2]%360*wn:0,E()):[m*Sn,y*Sn,_*Sn]},C.angle=function(t){return arguments.length?(v=t%360*wn,E()):v*Sn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Ir(o,M=t*t),P()):In(M)},C.fitExtent=function(t,e){return Cr(C,t,e)},C.fitSize=function(t,e){return Tr(C,t,e)},C.fitWidth=function(t,e){return Er(C,t,e)},C.fitHeight=function(t,e){return Pr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function Hr(t){var e=0,i=_n/3,n=zr(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*wn,i=t[1]*wn):[e*Sn,i*Sn]},s}function jr(t,e){var i=Rn(t),n=(i+Rn(e))/2;if(An(n)2?t[2]*wn:0),e.invert=function(e){return(e=t.invert(e[0]*wn,e[1]*wn))[0]*=Sn,e[1]*=Sn,e},e}(s.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Xr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function qr(t){return Dn((vn+t)/2)}function Zr(t,e){var i=Cn(t),n=t===e?Rn(t):En(i/Cn(e))/En(qr(e)/qr(t)),s=i*Pn(qr(t),n)/n;if(!n)return Xr;function r(t,e){s>0?e<-vn+yn&&(e=-vn+yn):e>vn-yn&&(e=vn-yn);var i=s/Pn(qr(e),n);return[i*Rn(n*t),s-i*Cn(n*t)]}return r.invert=function(t,e){var i=s-e,r=Bn(n)*In(t*t+i*i),a=Mn(t,An(i))*Bn(i);return i*n<0&&(a-=_n*Bn(t)*Bn(i)),[a/n,2*kn(Pn(s/r,1/n))-vn]},r}function Jr(t,e){return[t,e]}function Qr(t,e){var i=Cn(t),n=t===e?Rn(t):(i-Cn(e))/(e-t),s=i/n+t;if(An(n)yn&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},la.invert=Ur(On),ha.invert=Ur((function(t){return 2*kn(t)})),ca.invert=function(t,e){return[-e,2*kn(Tn(t))-vn]},$r().translate([0,0]).center([0,0]).scale(63781);var da=Object.prototype.hasOwnProperty;function ua(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^ma[2]^ma[3])}function _a(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=ua(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return ya(r[t])}function S(t,e){return pa(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=xa(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ba(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Ia(t,e)}))}:Ia(t,e)}function Ia(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=Da(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function Da(t,e){var i=Pa(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function za(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Ra(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=Ha(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=Ga(t.slice(0,n),e),o=Ga(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Ya=Ga;!function(t){var e=Ya;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=$a(Za,e),{tolerance:n}=i;return Xa(t,n)};var Qa;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Qa||(Qa={}));const to=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},eo=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+ao(e,6):ao(e,4))+"-"+ao(t.getUTCMonth()+1,2)+"-"+ao(t.getUTCDate(),2)+(r?"T"+ao(i,2)+":"+ao(n,2)+":"+ao(s,2)+"."+ao(r,3)+"Z":s?"T"+ao(i,2)+":"+ao(n,2)+":"+ao(s,2)+"Z":n||i?"T"+ao(i,2)+":"+ao(n,2)+"Z":"")}function lo(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return no;if(h)return h=!1,io;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Qa.DSV;const i=$a(uo,e),{delimiter:n}=i;if(!f(n))throw new TypeError("Invalid delimiter: must be a string!");return lo(n).parse(t)},go=function(t){return(arguments.length>2?arguments[2]:void 0).type=Qa.DSV,ho(t)},fo=function(t){return(arguments.length>2?arguments[2]:void 0).type=Qa.DSV,co(t)};function mo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return yo(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return yo(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return vo(t);default:throw new Error("unknown GeoJSON type")}}function yo(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=_o(t.properties),e.geometry=vo(t.geometry),e}function _o(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=_o(n):e[i]=n})),e):e}function vo(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return vo(t)})),e):(e.coordinates=bo(t.coordinates),e)}function bo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return bo(t)}))}function xo(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function So(t){for(var e,i,n=xo(t),s=0,r=1;r0}function wo(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=mo(t));var r=[];switch(t.type){case"GeometryCollection":return Ao(t,(function(t){Mo(t,n)})),t;case"FeatureCollection":return wo(t,(function(t){wo(Mo(t,n),(function(t){r.push(t)}))})),an(r)}return Mo(t,n)}function Mo(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Ao(t,(function(t){Mo(t,e)})),t;case"LineString":return Co(xo(t),e),t;case"Polygon":return To(xo(t),e),t;case"MultiLineString":return xo(t).forEach((function(t){Co(t,e)})),t;case"MultiPolygon":return xo(t).forEach((function(t){To(t,e)})),t;case"Point":case"MultiPoint":return t}}function Co(t,e){So(t)===e&&t.reverse()}function To(t,e){So(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Eo(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Io=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Qa.GEO;const i=$a(Ro,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Bo(t))})):e.push(Bo(t))})),e})(t);let o=t.features;return a&&(o=ko(t,{reverse:!d(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Po.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Po.bounds(t);t.bbox=e}})),t.features=o,t},Do={},Lo=(t,e,i)=>{i.type=Qa.GEO;const n=$a(Ro,Do,e),{object:s}=n;if(!f(s))throw new TypeError("Invalid object: must be a string!");const r=Ba(t,t.objects[s]);return Io(r,n,i)},Oo=(t,e,i)=>{const n=!o(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!m(t))throw new TypeError("Invalid data: must be DataView array!");return m(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Fo=0;function zo(){return Fo>1e8&&(Fo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+Fo++}class Ho{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new r,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:zo("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){this.transformMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const jo="_data-view-diff-rank";class No{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new r,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:zo("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",eo),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=R(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[jo]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[jo]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[jo][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear};utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear};parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1};parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1};parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1};parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1};parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1};parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1};parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1};parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Wo(t,e){const i=new Set(N(t)),n=new Set(N(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Uo}=le,Go=(t,e)=>(l(Xo.warnHandler)&&Xo.warnHandler.call(null,t,e),e?Ve.getInstance().warn(`[VChart warn]: ${t}`,e):Ve.getInstance().warn(`[VChart warn]: ${t}`)),Yo=(t,e,i)=>{const n=new Error(t);return Ve.getInstance().error(`[VChart error]: ${n}`,e)},Xo={silent:!1,warnHandler:!1,errorHandler:!1},$o="undefined"!=typeof window&&void 0!==window.document,Ko=$o&&globalThis.document;function qo(t){return("desktop-browser"===t||"mobile-browser"===t)&&$o}function Zo(t){return"miniApp"===t||"mobile-browser"===t}function Jo(t){return t.includes("miniApp")||"lynx"===t}let Qo=0;function tl(){return Qo>=9999999&&(Qo=0),Qo++}function el(t){return!h(t)&&(!!v(t)||+t==+t)}function il(t){return!(!t||0===t.length)&&(!h(t[0])&&!h(t[0].dataId)&&m(t[0].fields))}const nl=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const sl=t=>e=>C(e,t),rl=t=>{Ve.getInstance().error(t)},al=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||rl("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&rl("Access path missing closing bracket: "+t),a&&rl("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return nl((i&&i.get||sl)(n),[s],e||s)},ol=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m(t)){const n=t.map((t=>al(t,e,i)));return t=>n.map((e=>e(t)))}return al(t,e,i)};ol("id");const ll=nl((function(t){return t}),[],"identity"),hl=nl((function(){return 0}),[],"zero");nl((function(){return 1}),[],"one"),nl((function(){return!0}),[],"true"),nl((function(){return!1}),[],"false"),nl((function(){return{}}),[],"emptyObject");const cl=(t,e)=>{if((te||h(e))&&!h(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},dl=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>cl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=N(e)||[],s=[],r=[],a={},o=i.comparator||dl;return N(t).forEach(((t,e)=>{if(h(t))return;s.push("desc"===n[e]?-1:1);const o=l(t)?t:ol(t,null,i);var c;r.push(o),(c=o,(h(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:nl(o(r,s),Object.keys(a))},pl=(t,e)=>{const i=l(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(h(e)||h(i))return h(e)&&h(i);if(!u(e)&&!u(i))return e===i;const s=m(e)?e:e[t],r=m(i)?i:i[t];return s===r||!1!==n&&(m(r)?!(!m(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!d(r)&&!(!d(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>gl(t,r,s)))))},fl=(t,e)=>h(t)?e:Math.min(f(t)?e*parseFloat(t)/100:t,e);function ml(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!h(s)&&(s=+s)>=s&&!h(r)&&(r=+r)>=r&&n(s,r,++a)}))}function yl(t,e,i,n,s){let r=0,a=0;return ml(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function _l(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;ml(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:yl(t,e,i,s,h)}}const vl=rt;function bl(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const xl=t=>b(t)?Ut(t):null,Sl=t=>b(t)?Gt(t):null;function wl(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Al(t,e,i,n){const s=wl({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function kl(t){return 3===t||4===t}function Ml(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}function Cl(t,e){const i=e?+t[0][e]:+t[0];if(!b(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&n{const n=e?+i[e]:+i;return b(n)&&n>t&&(t=n),t}),i)}function El(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;b(s)&&(i+=s,n++)}));return i/n}function Pl(t,e){const i=El(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Rl(t){let e="center",i="middle";return e=(t=bl(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}}function Bl(t,e){const i=Il(t),n=Il(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function Il(t,e={x:0,y:0}){return jt.distancePP(t,e)}function Dl(t,e,i){let n=!1;if(e&&l(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function Ll(t){return function(e){let i;return i=m(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var Ol;function Fl(t){switch(t){case Ol.Linear:case Ol.Log:case Ol.Pow:case Ol.Sqrt:case Ol.Symlog:case Ol.Time:return!0;default:return!1}}function zl(t){switch(t){case Ol.Linear:case Ol.Log:case Ol.Pow:case Ol.Sqrt:case Ol.Symlog:case Ol.Time:case Ol.Ordinal:case Ol.Point:case Ol.Band:return!0;default:return!1}}function Hl(t){switch(t){case Ol.Ordinal:case Ol.Point:case Ol.Band:return!0;default:return!1}}!function(t){t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(Ol||(Ol={}));class jl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Nl=Symbol("implicit");class Vl extends jl{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Ol.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Nl}clone(){return(new Vl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!h(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==Nl)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Gl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),Yl=t=>t<0?-t*t:t*t,Xl=t=>-Math.log(-t),$l=t=>-Math.exp(-t),Kl=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ql=t=>10===t?Kl:t===Math.E?Math.exp:e=>Math.pow(t,e),Zl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Jl=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Ql=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function th(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function eh(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function ih(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class rh extends Vl{constructor(t){super(),this.type=Ol.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Y(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[$(t[0]),$(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[$(t[0]),$(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:sh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return sh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}clone(){return new rh(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:ah}=le;function oh(t,e){const i=typeof e;let n;if(h(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=se.parseColorString(e)){const e=ah(se.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof re?ah(t,e):e instanceof se?ah(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class lh extends jl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Wl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Wl,this._piecewise=eh,this._interpolate=oh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,$);return this._domain=i,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=yt,this.rescale(e)}rescale(t){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=ut(this._domain[0],this._domain[n-1])),this._piecewise=n>2?ih:eh,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Wl),this.rescale(i)):this._clamp!==Wl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const hh=Math.sqrt(50),ch=Math.sqrt(10),dh=Math.sqrt(2);function uh(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=hh?a=10:r>=ch?a=5:r>=dh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function gh(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=ph(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class yh extends lh{constructor(){super(...arguments),this.type=Ol.Linear}clone(){return(new yh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return uh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return gh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=mh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=mh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=mh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function _h(t){return e=>-t(-e)}class vh extends lh{constructor(){super(Zl(10),ql(10)),this.type=Ol.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new vh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){if(t)return this;super.rescale();const e=Zl(this._base),i=ql(this._base);return this._domain[0]<0?(this._logs=_h(e),this._pows=_h(i),this.transformer=Xl,this.untransformer=$l):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Wl}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.lengththis._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}}class bh extends rh{constructor(t){super(!1),this.type=Ol.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class xh extends yh{constructor(){super(),this.type=Ol.Pow,this._exponent=1}clone(){return(new xh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=Wl,this.untransformer=Wl):.5===this._exponent?(this.transformer=Gl,this.untransformer=Yl):(this.transformer=Ul(this._exponent),this.untransformer=Ul(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function Sh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class wh{constructor(){this.type=Ol.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return Sh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new Ah).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return uh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return gh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return fh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=mh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=mh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=mh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class kh extends yh{constructor(){super(Gl,Yl),this.type=Ol.Sqrt}clone(){return(new kh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Mh extends yh{constructor(){super(Jl(1),Ql(1)),this.type=Ol.Symlog,this._const=1}clone(){return(new Mh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=Jl(t),this.untransformer=Ql(t),this.rescale(e)):this._const}}class Ch{constructor(){this.type=Ol.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!h(t)&&b(+t)?this._range[q(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new Ch).domain(this._domain).range(this._range).unknown(this._unknown)}}const Th=[["second",1,Je],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,Qe],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,ti],["hour",3,3*ti],["hour",6,6*ti],["hour",12,12*ti],["day",1,ei],["day",2,2*ei],["day",7,7*ei],["month",1,ii],["month",3,3*ii],["month",6,6*ii],["year",1,365*ei]];function Eh(t){return+xt(t)}function Ph(t,e,i,n){const s=(+e-+t)/i,r=q(Th.map((t=>t[2])),s);if(r===Th.length){const s=Math.max(it(+t/ni,+e/ni,i),1),r=t=>(t[Ze(n)](Math.floor(t[Ue(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Ze(n)](t[Ue(n)]()+e*s),t);return{floor:r,offset:a,ceil:Ji(r,a)}}if(0===r){const n=Math.max(it(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Ji(s,r)}}const[a,o]=Th[s/Th[r-1][2]"year"===t&&e?{floor:li,offset:hi,count:ci,field:di}:"month"===t&&e?{floor:mi,offset:yi,count:_i,field:vi}:"day"===t&&e?{floor:Ai,offset:ki,count:Mi,field:Ci}:"hour"===t&&e?{floor:Bi,offset:Ii,count:Pi,field:Di}:"minute"===t&&e?{floor:Hi,offset:ji,count:Fi,field:Ni}:"second"===t&&e?{floor:Yi,offset:Xi,count:Ui,field:$i}:"year"===t?{floor:si,offset:ri,count:ai,field:oi}:"month"===t?{floor:ui,offset:pi,count:gi,field:fi}:"day"===t?{floor:bi,offset:xi,count:Si,field:wi}:"hour"===t?{floor:Ti,offset:Ei,count:Pi,field:Ri}:"minute"===t?{floor:Li,offset:Oi,count:Fi,field:zi}:"second"===t?{floor:Vi,offset:Wi,count:Ui,field:Gi}:{floor:Ki,offset:qi,count:Zi})(a,n);return Qi(o,l)}class Rh extends lh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=Ol.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(xt);const i=Array.from(t,Eh);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=xt(t),s=e[Ue(n)](),r=e[Ge(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Ye(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[Xe(n)](),c=(h-1)%12+1,d=e[$e(n)](),u=e[Ke(n)](),p=e[qe(n)]();return(i||"").replace(/YYYY/g,ht(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,ht(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,ht(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,ht(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,ht(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,ht(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,ht(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,ht(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Rh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(v(t)||h(t))&&(i=Ph(e[0],e[e.length-1],h(t)?10:t,this._isUtc)),i&&this.domain(nh(e,i)),this}utc(){return this._isUtc}}function Bh(t,e){const i=c(e)?t?.[e]??t?.default:t?.default;if(!i||m(i))return i;if(d(i)){const{dataScheme:n}=i;return n?Fh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>Oh(i)?Dh(t,i,e):i)).filter(c)}))):n.map((i=>Oh(i)?Dh(t,i,e):i)).filter(c):[]}return[]}function Ih(t,e){return Fh(t)?t.find((t=>c(t.isAvailable)?l(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!c(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function Dh(t,e,i){const n=c(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!c(e.a)&&!c(e.l)||!f(s))return s;let r=new Uo(s);if(c(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Jt(t,i,n),o=Zt(s,a,e.l),l=new Uo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return c(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Lh=(t,e,i)=>{if(Oh(t)&&e){const n=Dh(e,t,i);if(n)return n}return t};function Oh(t){return d(t)&&"palette"===t.type&&!!t.key}function Fh(t){return!!m(t)&&t.every((t=>c(t.scheme)))}class zh extends Vl{_range;range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Fh(this._range))return void super.range(this._range);const t=Ih(this._range,this._domain);super.range(t)}}const Hh={linear:yh,band:rh,point:bh,ordinal:Vl,threshold:Ch,colorOrdinal:zh};function jh(t){const e=Hh[t];return e?new e:null}function Nh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Vh(t){return c(t?.field)&&c(t?.scale)}var Wh;function Uh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Gh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Yh(t){return!!f(t)&&(!!t.endsWith("%")&&el(t.substring(0,t.length-1)))}function Xh(t,e,i){return v(t)?t:Yh(t)?Number(t.substring(0,t.length-1))*e/100:l(t)?t(i):0}function $h(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>v(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=Xh(t[s],e.size,i)}))})),n}function Kh(t){let e={};return m(t)?(h(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),h(t[1])||(e.left=e.right=t[1]),h(t[2])||(e.bottom=t[2]),h(t[3])||(e.left=t[3]),e):v(t)||Yh(t)||l(t)?(e.top=e.left=e.bottom=e.right=t,e):(d(t)&&(e={...t}),e)}function qh(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function Zh(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=Zh(t[n],e)}return i}return m(t)?t.map((t=>Zh(t,e))):t}function Jh(t){const e=t;let i;if(!c(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof No||e.every((t=>i.includes(t)))}(e))return e;const n=m(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:o(e)||v(e)||f(e)?e:_(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=Jh(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(Wh||(Wh={}));var Qh=function(t){return t&&t.Math==Math&&t},tc=Qh("object"==typeof globalThis&&globalThis)||Qh("object"==typeof window&&window)||Qh("object"==typeof self&&self)||Qh("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),ec={},ic=function(t){try{return!!t()}catch(t){return!0}},nc=!ic((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),sc=!ic((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),rc=sc,ac=Function.prototype.call,oc=rc?ac.bind(ac):function(){return ac.apply(ac,arguments)},lc={},hc={}.propertyIsEnumerable,cc=Object.getOwnPropertyDescriptor,dc=cc&&!hc.call({1:2},1);lc.f=dc?function(t){var e=cc(this,t);return!!e&&e.enumerable}:hc;var uc,pc,gc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},fc=sc,mc=Function.prototype,yc=mc.call,_c=fc&&mc.bind.bind(yc,yc),vc=fc?_c:function(t){return function(){return yc.apply(t,arguments)}},bc=vc,xc=bc({}.toString),Sc=bc("".slice),wc=function(t){return Sc(xc(t),8,-1)},Ac=ic,kc=wc,Mc=Object,Cc=vc("".split),Tc=Ac((function(){return!Mc("z").propertyIsEnumerable(0)}))?function(t){return"String"==kc(t)?Cc(t,""):Mc(t)}:Mc,Ec=function(t){return null==t},Pc=Ec,Rc=TypeError,Bc=function(t){if(Pc(t))throw Rc("Can't call method on "+t);return t},Ic=Tc,Dc=Bc,Lc=function(t){return Ic(Dc(t))},Oc="object"==typeof document&&document.all,Fc={all:Oc,IS_HTMLDDA:void 0===Oc&&void 0!==Oc},zc=Fc.all,Hc=Fc.IS_HTMLDDA?function(t){return"function"==typeof t||t===zc}:function(t){return"function"==typeof t},jc=Hc,Nc=Fc.all,Vc=Fc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:jc(t)||t===Nc}:function(t){return"object"==typeof t?null!==t:jc(t)},Wc=tc,Uc=Hc,Gc=function(t,e){return arguments.length<2?(i=Wc[t],Uc(i)?i:void 0):Wc[t]&&Wc[t][e];var i},Yc=vc({}.isPrototypeOf),Xc=tc,$c="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Kc=Xc.process,qc=Xc.Deno,Zc=Kc&&Kc.versions||qc&&qc.version,Jc=Zc&&Zc.v8;Jc&&(pc=(uc=Jc.split("."))[0]>0&&uc[0]<4?1:+(uc[0]+uc[1])),!pc&&$c&&(!(uc=$c.match(/Edge\/(\d+)/))||uc[1]>=74)&&(uc=$c.match(/Chrome\/(\d+)/))&&(pc=+uc[1]);var Qc=pc,td=ic,ed=tc.String,id=!!Object.getOwnPropertySymbols&&!td((function(){var t=Symbol();return!ed(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Qc&&Qc<41})),nd=id&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,sd=Gc,rd=Hc,ad=Yc,od=Object,ld=nd?function(t){return"symbol"==typeof t}:function(t){var e=sd("Symbol");return rd(e)&&ad(e.prototype,od(t))},hd=String,cd=function(t){try{return hd(t)}catch(t){return"Object"}},dd=Hc,ud=cd,pd=TypeError,gd=function(t){if(dd(t))return t;throw pd(ud(t)+" is not a function")},fd=gd,md=Ec,yd=function(t,e){var i=t[e];return md(i)?void 0:fd(i)},_d=oc,vd=Hc,bd=Vc,xd=TypeError,Sd={exports:{}},wd=tc,Ad=Object.defineProperty,kd=function(t,e){try{Ad(wd,t,{value:e,configurable:!0,writable:!0})}catch(i){wd[t]=e}return e},Md=kd,Cd="__core-js_shared__",Td=tc[Cd]||Md(Cd,{}),Ed=Td;(Sd.exports=function(t,e){return Ed[t]||(Ed[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Pd=Sd.exports,Rd=Bc,Bd=Object,Id=function(t){return Bd(Rd(t))},Dd=Id,Ld=vc({}.hasOwnProperty),Od=Object.hasOwn||function(t,e){return Ld(Dd(t),e)},Fd=vc,zd=0,Hd=Math.random(),jd=Fd(1..toString),Nd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+jd(++zd+Hd,36)},Vd=Pd,Wd=Od,Ud=Nd,Gd=id,Yd=nd,Xd=tc.Symbol,$d=Vd("wks"),Kd=Yd?Xd.for||Xd:Xd&&Xd.withoutSetter||Ud,qd=function(t){return Wd($d,t)||($d[t]=Gd&&Wd(Xd,t)?Xd[t]:Kd("Symbol."+t)),$d[t]},Zd=oc,Jd=Vc,Qd=ld,tu=yd,eu=function(t,e){var i,n;if("string"===e&&vd(i=t.toString)&&!bd(n=_d(i,t)))return n;if(vd(i=t.valueOf)&&!bd(n=_d(i,t)))return n;if("string"!==e&&vd(i=t.toString)&&!bd(n=_d(i,t)))return n;throw xd("Can't convert object to primitive value")},iu=TypeError,nu=qd("toPrimitive"),su=function(t,e){if(!Jd(t)||Qd(t))return t;var i,n=tu(t,nu);if(n){if(void 0===e&&(e="default"),i=Zd(n,t,e),!Jd(i)||Qd(i))return i;throw iu("Can't convert object to primitive value")}return void 0===e&&(e="number"),eu(t,e)},ru=ld,au=function(t){var e=su(t,"string");return ru(e)?e:e+""},ou=Vc,lu=tc.document,hu=ou(lu)&&ou(lu.createElement),cu=function(t){return hu?lu.createElement(t):{}},du=cu,uu=!nc&&!ic((function(){return 7!=Object.defineProperty(du("div"),"a",{get:function(){return 7}}).a})),pu=nc,gu=oc,fu=lc,mu=gc,yu=Lc,_u=au,vu=Od,bu=uu,xu=Object.getOwnPropertyDescriptor;ec.f=pu?xu:function(t,e){if(t=yu(t),e=_u(e),bu)try{return xu(t,e)}catch(t){}if(vu(t,e))return mu(!gu(fu.f,t,e),t[e])};var Su={},wu=nc&&ic((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Au=Vc,ku=String,Mu=TypeError,Cu=function(t){if(Au(t))return t;throw Mu(ku(t)+" is not an object")},Tu=nc,Eu=uu,Pu=wu,Ru=Cu,Bu=au,Iu=TypeError,Du=Object.defineProperty,Lu=Object.getOwnPropertyDescriptor,Ou="enumerable",Fu="configurable",zu="writable";Su.f=Tu?Pu?function(t,e,i){if(Ru(t),e=Bu(e),Ru(i),"function"==typeof t&&"prototype"===e&&"value"in i&&zu in i&&!i[zu]){var n=Lu(t,e);n&&n[zu]&&(t[e]=i.value,i={configurable:Fu in i?i[Fu]:n[Fu],enumerable:Ou in i?i[Ou]:n[Ou],writable:!1})}return Du(t,e,i)}:Du:function(t,e,i){if(Ru(t),e=Bu(e),Ru(i),Eu)try{return Du(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Iu("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var Hu=Su,ju=gc,Nu=nc?function(t,e,i){return Hu.f(t,e,ju(1,i))}:function(t,e,i){return t[e]=i,t},Vu={exports:{}},Wu=nc,Uu=Od,Gu=Function.prototype,Yu=Wu&&Object.getOwnPropertyDescriptor,Xu=Uu(Gu,"name"),$u={EXISTS:Xu,PROPER:Xu&&"something"===function(){}.name,CONFIGURABLE:Xu&&(!Wu||Wu&&Yu(Gu,"name").configurable)},Ku=Hc,qu=Td,Zu=vc(Function.toString);Ku(qu.inspectSource)||(qu.inspectSource=function(t){return Zu(t)});var Ju,Qu,tp,ep=qu.inspectSource,ip=Hc,np=tc.WeakMap,sp=ip(np)&&/native code/.test(String(np)),rp=Nd,ap=Pd("keys"),op=function(t){return ap[t]||(ap[t]=rp(t))},lp={},hp=sp,cp=tc,dp=Vc,up=Nu,pp=Od,gp=Td,fp=op,mp=lp,yp="Object already initialized",_p=cp.TypeError,vp=cp.WeakMap;if(hp||gp.state){var bp=gp.state||(gp.state=new vp);bp.get=bp.get,bp.has=bp.has,bp.set=bp.set,Ju=function(t,e){if(bp.has(t))throw _p(yp);return e.facade=t,bp.set(t,e),e},Qu=function(t){return bp.get(t)||{}},tp=function(t){return bp.has(t)}}else{var xp=fp("state");mp[xp]=!0,Ju=function(t,e){if(pp(t,xp))throw _p(yp);return e.facade=t,up(t,xp,e),e},Qu=function(t){return pp(t,xp)?t[xp]:{}},tp=function(t){return pp(t,xp)}}var Sp={set:Ju,get:Qu,has:tp,enforce:function(t){return tp(t)?Qu(t):Ju(t,{})},getterFor:function(t){return function(e){var i;if(!dp(e)||(i=Qu(e)).type!==t)throw _p("Incompatible receiver, "+t+" required");return i}}},wp=vc,Ap=ic,kp=Hc,Mp=Od,Cp=nc,Tp=$u.CONFIGURABLE,Ep=ep,Pp=Sp.enforce,Rp=Sp.get,Bp=String,Ip=Object.defineProperty,Dp=wp("".slice),Lp=wp("".replace),Op=wp([].join),Fp=Cp&&!Ap((function(){return 8!==Ip((function(){}),"length",{value:8}).length})),zp=String(String).split("String"),Hp=Vu.exports=function(t,e,i){"Symbol("===Dp(Bp(e),0,7)&&(e="["+Lp(Bp(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Mp(t,"name")||Tp&&t.name!==e)&&(Cp?Ip(t,"name",{value:e,configurable:!0}):t.name=e),Fp&&i&&Mp(i,"arity")&&t.length!==i.arity&&Ip(t,"length",{value:i.arity});try{i&&Mp(i,"constructor")&&i.constructor?Cp&&Ip(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Pp(t);return Mp(n,"source")||(n.source=Op(zp,"string"==typeof e?e:"")),t};Function.prototype.toString=Hp((function(){return kp(this)&&Rp(this).source||Ep(this)}),"toString");var jp=Vu.exports,Np=Hc,Vp=Su,Wp=jp,Up=kd,Gp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Np(i)&&Wp(i,r,n),n.global)s?t[e]=i:Up(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Vp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Yp={},Xp=Math.ceil,$p=Math.floor,Kp=Math.trunc||function(t){var e=+t;return(e>0?$p:Xp)(e)},qp=function(t){var e=+t;return e!=e||0===e?0:Kp(e)},Zp=qp,Jp=Math.max,Qp=Math.min,tg=function(t,e){var i=Zp(t);return i<0?Jp(i+e,0):Qp(i,e)},eg=qp,ig=Math.min,ng=function(t){return t>0?ig(eg(t),9007199254740991):0},sg=function(t){return ng(t.length)},rg=Lc,ag=tg,og=sg,lg=function(t){return function(e,i,n){var s,r=rg(e),a=og(r),o=ag(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},hg={includes:lg(!0),indexOf:lg(!1)},cg=Od,dg=Lc,ug=hg.indexOf,pg=lp,gg=vc([].push),fg=function(t,e){var i,n=dg(t),s=0,r=[];for(i in n)!cg(pg,i)&&cg(n,i)&&gg(r,i);for(;e.length>s;)cg(n,i=e[s++])&&(~ug(r,i)||gg(r,i));return r},mg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yg=fg,_g=mg.concat("length","prototype");Yp.f=Object.getOwnPropertyNames||function(t){return yg(t,_g)};var vg={};vg.f=Object.getOwnPropertySymbols;var bg=Gc,xg=Yp,Sg=vg,wg=Cu,Ag=vc([].concat),kg=bg("Reflect","ownKeys")||function(t){var e=xg.f(wg(t)),i=Sg.f;return i?Ag(e,i(t)):e},Mg=Od,Cg=kg,Tg=ec,Eg=Su,Pg=ic,Rg=Hc,Bg=/#|\.prototype\./,Ig=function(t,e){var i=Lg[Dg(t)];return i==Fg||i!=Og&&(Rg(e)?Pg(e):!!e)},Dg=Ig.normalize=function(t){return String(t).replace(Bg,".").toLowerCase()},Lg=Ig.data={},Og=Ig.NATIVE="N",Fg=Ig.POLYFILL="P",zg=Ig,Hg=tc,jg=ec.f,Ng=Nu,Vg=Gp,Wg=kd,Ug=function(t,e,i){for(var n=Cg(e),s=Eg.f,r=Tg.f,a=0;ar;r++)if((o=y(t[r]))&&vm(km,o))return o;return new Am(!1)}n=bm(t,s)}for(l=u?t.next:n.next;!(h=gm(l,n)).done;){try{o=y(h.value)}catch(t){Sm(n,"throw",t)}if("object"==typeof o&&o&&vm(km,o))return o}return new Am(!1)},Cm=Yc,Tm=TypeError,Em=function(t,e){if(Cm(e,t))return t;throw Tm("Incorrect invocation")},Pm=qd("iterator"),Rm=!1;try{var Bm=0,Im={next:function(){return{done:!!Bm++}},return:function(){Rm=!0}};Im[Pm]=function(){return this},Array.from(Im,(function(){throw 2}))}catch(rl){}var Dm=Su.f,Lm=Od,Om=qd("toStringTag"),Fm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Lm(t,Om)&&Dm(t,Om,{configurable:!0,value:e})},zm=vc,Hm=gd,jm=Hc,Nm=String,Vm=TypeError,Wm=function(t,e,i){try{return zm(Hm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Um=Cu,Gm=function(t){if("object"==typeof t||jm(t))return t;throw Vm("Can't set "+Nm(t)+" as a prototype")},Ym=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Wm(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Um(i),Gm(n),e?t(i,n):i.__proto__=n,i}}():void 0),Xm=Hc,$m=Vc,Km=Ym,qm=Yg,Zm=tc,Jm=vc,Qm=zg,ty=Gp,ey=Bf,iy=Mm,ny=Em,sy=Hc,ry=Ec,ay=Vc,oy=ic,ly=function(t,e){if(!e&&!Rm)return!1;var i=!1;try{var n={};n[Pm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},hy=Fm,cy=function(t,e,i){var n,s;return Km&&Xm(n=e.constructor)&&n!==i&&$m(s=n.prototype)&&s!==i.prototype&&Km(t,s),t},dy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=Zm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=Jm(o[t]);ty(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!ay(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!ay(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!ay(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Qm(t,!sy(a)||!(s||o.forEach&&!oy((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),ey.enable();else if(Qm(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=oy((function(){d.has(1)})),g=ly((function(t){new a(t)})),f=!s&&oy((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){ny(t,o);var i=cy(new a,t,l);return ry(e)||iy(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,qm({global:!0,constructor:!0,forced:l!=a},h),hy(l,t),s||i.setStrong(l,t,n),l},uy={},py=fg,gy=mg,fy=Object.keys||function(t){return py(t,gy)},my=nc,yy=wu,_y=Su,vy=Cu,by=Lc,xy=fy;uy.f=my&&!yy?Object.defineProperties:function(t,e){vy(t);for(var i,n=by(e),s=xy(e),r=s.length,a=0;r>a;)_y.f(t,i=s[a++],n[i]);return t};var Sy,wy=Gc("document","documentElement"),Ay=Cu,ky=uy,My=mg,Cy=lp,Ty=wy,Ey=cu,Py="prototype",Ry="script",By=op("IE_PROTO"),Iy=function(){},Dy=function(t){return"<"+Ry+">"+t+""},Ly=function(t){t.write(Dy("")),t.close();var e=t.parentWindow.Object;return t=null,e},Oy=function(){try{Sy=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Oy="undefined"!=typeof document?document.domain&&Sy?Ly(Sy):(e=Ey("iframe"),i="java"+Ry+":",e.style.display="none",Ty.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Dy("document.F=Object")),t.close(),t.F):Ly(Sy);for(var n=My.length;n--;)delete Oy[Py][My[n]];return Oy()};Cy[By]=!0;var Fy,zy,Hy,jy=Object.create||function(t,e){var i;return null!==t?(Iy[Py]=Ay(t),i=new Iy,Iy[Py]=null,i[By]=t):i=Oy(),void 0===e?i:ky.f(i,e)},Ny=jp,Vy=Su,Wy=function(t,e,i){return i.get&&Ny(i.get,e,{getter:!0}),i.set&&Ny(i.set,e,{setter:!0}),Vy.f(t,e,i)},Uy=Gp,Gy=function(t,e,i){for(var n in e)Uy(t,n,e[n],i);return t},Yy=!ic((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Xy=Od,$y=Hc,Ky=Id,qy=Yy,Zy=op("IE_PROTO"),Jy=Object,Qy=Jy.prototype,t_=qy?Jy.getPrototypeOf:function(t){var e=Ky(t);if(Xy(e,Zy))return e[Zy];var i=e.constructor;return $y(i)&&e instanceof i?i.prototype:e instanceof Jy?Qy:null},e_=ic,i_=Hc,n_=Vc,s_=t_,r_=Gp,a_=qd("iterator"),o_=!1;[].keys&&("next"in(Hy=[].keys())?(zy=s_(s_(Hy)))!==Object.prototype&&(Fy=zy):o_=!0);var l_=!n_(Fy)||e_((function(){var t={};return Fy[a_].call(t)!==t}));l_&&(Fy={}),i_(Fy[a_])||r_(Fy,a_,(function(){return this}));var h_={IteratorPrototype:Fy,BUGGY_SAFARI_ITERATORS:o_},c_=h_.IteratorPrototype,d_=jy,u_=gc,p_=Fm,g_=jf,f_=function(){return this},m_=Yg,y_=oc,__=Hc,v_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=d_(c_,{next:u_(+!n,i)}),p_(t,s,!1),g_[s]=f_,t},b_=t_,x_=Ym,S_=Fm,w_=Nu,A_=Gp,k_=jf,M_=$u.PROPER,C_=$u.CONFIGURABLE,T_=h_.IteratorPrototype,E_=h_.BUGGY_SAFARI_ITERATORS,P_=qd("iterator"),R_="keys",B_="values",I_="entries",D_=function(){return this},L_=Gc,O_=Wy,F_=nc,z_=qd("species"),H_=jy,j_=Wy,N_=Gy,V_=Hf,W_=Em,U_=Ec,G_=Mm,Y_=function(t,e,i,n,s,r,a){v_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!E_&&t in p)return p[t];switch(t){case R_:case B_:case I_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[P_]||p["@@iterator"]||s&&p[s],f=!E_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=b_(m.call(new t)))!==Object.prototype&&o.next&&(b_(o)!==T_&&(x_?x_(o,T_):__(o[P_])||A_(o,P_,D_)),S_(o,d,!0)),M_&&s==B_&&g&&g.name!==B_&&(C_?w_(p,"name",B_):(u=!0,f=function(){return y_(g,this)})),s)if(l={values:c(B_),keys:r?f:c(R_),entries:c(I_)},a)for(h in l)(E_||u||!(h in p))&&A_(p,h,l[h]);else m_({target:e,proto:!0,forced:E_||u},l);return p[P_]!==f&&A_(p,P_,f,{name:s}),k_[e]=f,l},X_=function(t,e){return{value:t,done:e}},$_=function(t){var e=L_(t);F_&&e&&!e[z_]&&O_(e,z_,{configurable:!0,get:function(){return this}})},K_=nc,q_=Bf.fastKey,Z_=Sp.set,J_=Sp.getterFor,Q_={getConstructor:function(t,e,i,n){var s=t((function(t,s){W_(t,r),Z_(t,{type:e,index:H_(null),first:void 0,last:void 0,size:0}),K_||(t.size=0),U_(s)||G_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=J_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=q_(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),K_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=q_(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return N_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,K_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),K_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=V_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),N_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),K_&&j_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=J_(e),r=J_(n);Y_(t,e,(function(t,e){Z_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?X_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,X_(void 0,!0))}),i?"entries":"values",!i,!0),$_(e)}};dy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Q_);var tv=wc,ev=Array.isArray||function(t){return"Array"==tv(t)},iv=vc,nv=ic,sv=Hc,rv=Zf,av=ep,ov=function(){},lv=[],hv=Gc("Reflect","construct"),cv=/^\s*(?:class|function)\b/,dv=iv(cv.exec),uv=!cv.exec(ov),pv=function(t){if(!sv(t))return!1;try{return hv(ov,lv,t),!0}catch(t){return!1}},gv=function(t){if(!sv(t))return!1;switch(rv(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return uv||!!dv(cv,av(t))}catch(t){return!0}};gv.sham=!0;var fv=!hv||nv((function(){var t;return pv(pv.call)||!pv(Object)||!pv((function(){t=!0}))||t}))?gv:pv,mv=ev,yv=fv,_v=Vc,vv=qd("species"),bv=Array,xv=function(t){var e;return mv(t)&&(e=t.constructor,(yv(e)&&(e===bv||mv(e.prototype))||_v(e)&&null===(e=e[vv]))&&(e=void 0)),void 0===e?bv:e},Sv=Hf,wv=Tc,Av=Id,kv=sg,Mv=function(t,e){return new(xv(t))(0===e?0:e)},Cv=vc([].push),Tv=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=Av(l),f=wv(g),m=Sv(h,c),y=kv(f),_=0,v=d||Mv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Cv(b,u)}else switch(t){case 4:return!1;case 7:Cv(b,u)}return r?-1:n||s?s:b}},Ev={forEach:Tv(0),map:Tv(1),filter:Tv(2),some:Tv(3),every:Tv(4),find:Tv(5),findIndex:Tv(6),filterReject:Tv(7)},Pv=vc,Rv=Gy,Bv=Bf.getWeakData,Iv=Em,Dv=Cu,Lv=Ec,Ov=Vc,Fv=Mm,zv=Od,Hv=Sp.set,jv=Sp.getterFor,Nv=Ev.find,Vv=Ev.findIndex,Wv=Pv([].splice),Uv=0,Gv=function(t){return t.frozen||(t.frozen=new Yv)},Yv=function(){this.entries=[]},Xv=function(t,e){return Nv(t.entries,(function(t){return t[0]===e}))};Yv.prototype={get:function(t){var e=Xv(this,t);if(e)return e[1]},has:function(t){return!!Xv(this,t)},set:function(t,e){var i=Xv(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Vv(this.entries,(function(e){return e[0]===t}));return~e&&Wv(this.entries,e,1),!!~e}};var $v,Kv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Iv(t,r),Hv(t,{type:e,id:Uv++,frozen:void 0}),Lv(s)||Fv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=jv(e),o=function(t,e,i){var n=a(t),s=Bv(Dv(e),!0);return!0===s?Gv(n).set(e,i):s[n.id]=i,t};return Rv(r,{delete:function(t){var e=a(this);if(!Ov(t))return!1;var i=Bv(t);return!0===i?Gv(e).delete(t):i&&zv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!Ov(t))return!1;var i=Bv(t);return!0===i?Gv(e).has(t):i&&zv(i,e.id)}}),Rv(r,i?{get:function(t){var e=a(this);if(Ov(t)){var i=Bv(t);return!0===i?Gv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},qv=mf,Zv=tc,Jv=vc,Qv=Gy,tb=Bf,eb=dy,ib=Kv,nb=Vc,sb=Sp.enforce,rb=ic,ab=sp,ob=Object,lb=Array.isArray,hb=ob.isExtensible,cb=ob.isFrozen,db=ob.isSealed,ub=ob.freeze,pb=ob.seal,gb={},fb={},mb=!Zv.ActiveXObject&&"ActiveXObject"in Zv,yb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},_b=eb("WeakMap",yb,ib),vb=_b.prototype,bb=Jv(vb.set);if(ab)if(mb){$v=ib.getConstructor(yb,"WeakMap",!0),tb.enable();var xb=Jv(vb.delete),Sb=Jv(vb.has),wb=Jv(vb.get);Qv(vb,{delete:function(t){if(nb(t)&&!hb(t)){var e=sb(this);return e.frozen||(e.frozen=new $v),xb(this,t)||e.frozen.delete(t)}return xb(this,t)},has:function(t){if(nb(t)&&!hb(t)){var e=sb(this);return e.frozen||(e.frozen=new $v),Sb(this,t)||e.frozen.has(t)}return Sb(this,t)},get:function(t){if(nb(t)&&!hb(t)){var e=sb(this);return e.frozen||(e.frozen=new $v),Sb(this,t)?wb(this,t):e.frozen.get(t)}return wb(this,t)},set:function(t,e){if(nb(t)&&!hb(t)){var i=sb(this);i.frozen||(i.frozen=new $v),Sb(this,t)?bb(this,t,e):i.frozen.set(t,e)}else bb(this,t,e);return this}})}else qv&&rb((function(){var t=ub([]);return bb(new _b,t,1),!cb(t)}))&&Qv(vb,{set:function(t,e){var i;return lb(t)&&(cb(t)?i=gb:db(t)&&(i=fb)),bb(this,t,e),i==gb&&ub(t),i==fb&&pb(t),this}});var Ab=Gc,kb=vc,Mb=Pd,Cb=Ab("Map"),Tb=Ab("WeakMap"),Eb=kb([].push),Pb=Mb("metadata"),Rb=Pb.store||(Pb.store=new Tb),Bb=function(t,e,i){var n=Rb.get(t);if(!n){if(!i)return;Rb.set(t,n=new Cb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Cb)}return s},Ib={store:Rb,getMap:Bb,has:function(t,e,i){var n=Bb(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Bb(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Bb(i,n,!0).set(t,e)},keys:function(t,e){var i=Bb(t,e,!1),n=[];return i&&i.forEach((function(t,e){Eb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Db=Cu,Lb=Ib.toKey,Ob=Ib.set;Yg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Lb(arguments[3]);Ob(t,e,Db(i),n)}});var Fb=Cu,zb=Ib.toKey,Hb=Ib.getMap,jb=Ib.store;Yg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:zb(arguments[2]),n=Hb(Fb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=jb.get(e);return s.delete(i),!!s.size||jb.delete(e)}});var Nb=Cu,Vb=t_,Wb=Ib.has,Ub=Ib.get,Gb=Ib.toKey,Yb=function(t,e,i){if(Wb(t,e,i))return Ub(t,e,i);var n=Vb(e);return null!==n?Yb(t,n,i):void 0};Yg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Gb(arguments[2]);return Yb(t,Nb(e),i)}});var Xb=vc,$b=Map.prototype,Kb={Map:Map,set:Xb($b.set),get:Xb($b.get),has:Xb($b.has),remove:Xb($b.delete),proto:$b},qb=oc,Zb=vc,Jb=function(t,e,i){for(var n,s,r=i||t.next;!(n=qb(r,t)).done;)if(void 0!==(s=e(n.value)))return s},Qb=Kb.Map,tx=Kb.proto,ex=Zb(tx.forEach),ix=Zb(tx.entries),nx=ix(new Qb).next,sx=gd,rx=Ec,ax=sg,ox=Id,lx=function(t,e,i){return i?Jb(ix(t),(function(t){return e(t[1],t[0])}),nx):ex(t,e)},hx=Kb.Map,cx=Kb.has,dx=Kb.set,ux=vc([].push),px=Yg,gx=vc,fx=Ib,mx=Cu,yx=t_,_x=function(t){var e,i,n,s=ox(this),r=ax(s),a=[],o=new hx,l=rx(t)?function(t){return t}:sx(t);for(e=0;e= than the number of constructor arguments of its base class."},mS=function(t,e){return"@postConstruct error in class "+t+": "+e},yS=function(t,e){return"@preDestroy error in class "+t+": "+e},_S=function(t,e){return"onDeactivation() error in class "+t+": "+e},vS="Maximum call stack size exceeded",bS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(qx,t),userGeneratedMetadata:Reflect.getMetadata($x,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(Kx,t)||[]},t}(),xS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function SS(t){return t instanceof RangeError||t.message===vS}function wS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function AS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=CS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function kS(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||kS(t.parentRequest,e))}function MS(t){t.childRequests.forEach((function(t){if(kS(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=wS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(pS+" "+e)}MS(t)}))}function CS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var TS=function(){function t(t){this.id=sS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),ES=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Vx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),PS=function(t,e){this.parentContext=t,this.rootRequest=e},RS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),BS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),IS=function(){function t(t,e,i,n){this.id=sS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new BS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new ES(Vx,n):n instanceof ES&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:HS(t,i)}return 0}function jS(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Yx],multiInject:e[Xx],targetName:e[Wx],unmanaged:e[Ux]}}var NS=function(){function t(t,e,i,n,s){this.id=sS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function VS(t){return t._bindingDictionary}function WS(t,e,i,n,s){var r=GS(i.container,s.serviceIdentifier),a=[];return r.length===xS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=GS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new NS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case xS.NoBindingsAvailable:if(i.isOptional())return e;var s=wS(t),r=cS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=AS(n,s,GS),new Error(r);case xS.OnlyOneBindingAvailable:return e;case xS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=wS(t),r=hS+" "+s;throw r+=AS(n,s,GS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function US(t,e,i,n,s,r){var a,o;if(null===s){a=WS(t,e,n,null,r),o=new NS(i,n,null,a,r);var l=new PS(n,o);n.addPlan(l)}else a=WS(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===eS.Instance&&null!==e.implementationType){var s=function(t,e){return LS(t,CS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=HS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===iS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=$S(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=ew(ew({},s),{constr:t});n=s.isAsync?function(t){return iw(this,void 0,void 0,(function(){var e,i;return nw(this,(function(n){switch(n.label){case 0:return[4,ow(t.constructorInjections)];case 1:return e=n.sent(),[4,ow(t.propertyInjections)];case 2:return i=n.sent(),[2,aw(ew(ew({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):aw(r)}else n=new t;return n}function aw(t){var e,i=new((e=t.constr).bind.apply(e,sw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function ow(t){return iw(this,void 0,void 0,(function(){var e,i,n,s;return nw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Lw=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Dw,onDeactivations:new Dw}},t}(),Ow=function(){return Ow=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new eA(e,i)})).inSingletonScope().whenTargetNamed(e)}class nA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class sA extends nA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const rA=Symbol.for("EnvContribution"),aA=Symbol.for("Global");var oA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hA=function(t,e){return function(i,n){e(i,n,t)}};let cA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new sA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};cA=oA([Yw(),hA(0,Kw(tA)),hA(0,Xw(rA)),lA("design:paramtypes",[Object])],cA);const dA=kt-1e-8;class uA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>dA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=kt)<0&&(n+=kt),(s%=kt)<0&&(s+=kt),ss;++o,a-=At)g(a);else for(a=n-n%At+At,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const gA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,fA={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},mA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let yA,_A,vA,bA,xA,SA;var wA,AA,kA,MA,CA,TA,EA,PA,RA;function BA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function IA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Ut(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=kt:T>0&&0===r&&(T-=kt);const E=Math.ceil(Math.abs(T/(At+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function OA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class YA extends GA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function XA(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class $A{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function KA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new GA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new $A(s,n),t),s}function qA(t,e,i,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n)}class ZA{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&qA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:qA(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function JA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return KA(t,e);const s=new GA("basis",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new ZA(s,n),t),s}function QA(t){return t<0?-1:1}function tk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(QA(r)+QA(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function ek(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function ik(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class nk{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined2);break;case 3:ik(this,this._t0,ek(this,this._t0),!1!==this._lastDefined2)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,ik(this,ek(this,e=tk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:ik(this,this._t0,e=tk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined}}tryUpdateLength(){return this.context.tryUpdateLength()}}class sk extends nk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function rk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return KA(t,e);const s=new GA("monotoneX",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new nk(s,n),t),s}function ak(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return KA(t,e);const s=new YA("monotoneY",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new sk(s,n),t),s}let ok=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function lk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new GA("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new ok(r,e,s),t),r}class hk{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){this.context.closePath()}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ck(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new GA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new hk(s,n),t),s}function dk(t,e,i){switch(e){case"linear":default:return KA(t,i);case"basis":return JA(t,i);case"monotoneX":return rk(t,i);case"monotoneY":return ak(t,i);case"step":return lk(t,.5,i);case"stepBefore":return lk(t,0,i);case"stepAfter":return lk(t,1,i);case"linearClosed":return ck(t,i)}}class uk extends pA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new uA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([mA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([mA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([mA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([mA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([mA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([mA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([mA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([mA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([mA.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const t=[];t[mA.M]=t=>`M${t[1]} ${t[2]}`,t[mA.L]=t=>`L${t[1]} ${t[2]}`,t[mA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[mA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[mA.A]=t=>{const e=[];DA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tSA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),OA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===EA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ct(t.p0.y-e.p1.y)}if(this.direction===EA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ct(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const pk=["l",0,0,0,0,0,0,0];function gk(t,e,i){const n=pk[0]=t[0];if("a"===n||"A"===n)pk[1]=e*t[1],pk[2]=i*t[2],pk[3]=t[3],pk[4]=t[4],pk[5]=t[5],pk[6]=e*t[6],pk[7]=i*t[7];else if("h"===n||"H"===n)pk[1]=e*t[1];else if("v"===n||"V"===n)pk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Ek=Object.assign(Object.assign({},xk),{points:[],cornerRadius:0}),Pk=Object.assign(Object.assign({},xk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Rk=Object.assign(Object.assign({},xk),{width:0,height:0,cornerRadius:0,length:0}),Bk=Object.assign(Object.assign({},xk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Ik=Object.assign(Object.assign(Object.assign({},xk),vk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dk=Object.assign(Object.assign({},xk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Lk=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},xk),{fill:!0}),Ok=Object.assign(Object.assign({},Lk),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});var Fk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Ik.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};zk=Fk([Yw()],zk);var Hk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const jk=Symbol.for("TextMeasureContribution");let Nk=class extends zk{};Nk=Hk([Yw()],Nk);const Vk=new jw;const Wk=new class{},Uk=Symbol.for("CanvasFactory"),Gk=Symbol.for("Context2dFactory");function Yk(t){return Vk.getNamed(Uk,Wk.global.env)(t)}const Xk=1e-4,$k=Math.sqrt(3),Kk=1/3;function qk(t){return t>-cM&&tcM||t<-cM}const Jk=[0,0],Qk=[0,0],tM=[0,0];function eM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function iM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function nM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function sM(t){return(t%=Mt)<0&&(t+=Mt),t}function rM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function aM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Mt);let d=Math.atan2(l,o);return d<0&&(d+=Mt),d>=n&&d<=s||d+Mt>=n&&d+Mt<=s}function hM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(qk(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const uM=[-1,-1,-1],pM=[-1,-1];function gM(){const t=pM[0];pM[0]=pM[1],pM[1]=t}function fM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(qk(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Kk):Math.pow(i,Kk),n=n<0?-Math.pow(-n,Kk):Math.pow(n,Kk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+$k*Math.sin(e)))/(3*a),h=(-o+i*(n-$k*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,uM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&gM(),p=nM(e,n,r,o,pM[0]),u>1&&(g=nM(e,n,r,o,pM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(qk(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,uM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=iM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);uM[0]=-l,uM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Mt-1e-4){n=0,s=Mt;const e=r?1:-1;return a>=uM[0]+t&&a<=uM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Mt,s+=Mt);let c=0;for(let e=0;e<2;e++){const i=uM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=s||t+Mt>=n&&t+Mt<=s)&&(t>wt/2&&t<1.5*wt&&(e=-e),c+=e)}}return c}function _M(t){return Math.round(t/wt*1e8)/1e8%2*wt}function vM(t,e){let i=_M(t[0]);i<0&&(i+=Mt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Mt?s=i+Mt:e&&i-s>=Mt?s=i-Mt:!e&&i>s?s=i+(Mt-_M(i-s)):e&&i1&&(i||(h+=rM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;bM[0]=S,bM[1]=w,vM(bM,Boolean(a[6])),S=bM[0],w=bM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case mA.M:u=m,p=y,c=u,d=p;break;case mA.L:if(i){if(hM(c,d,m,y,e,n,s))return!0}else h+=rM(c,d,m,y,n,s)||0;c=m,d=y;break;case mA.C:if(i){if(oM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=fM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case mA.Q:if(i){if(aM(c,d,m,y,_,v,e,n,s))return!0}else h+=mM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case mA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=rM(c,d,o,l,n,s),i){if(lM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=yM(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case mA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(hM(u,p,o,p,e,n,s)||hM(o,p,o,l,e,n,s)||hM(o,l,u,l,e,n,s)||hM(u,l,u,p,e,n,s))return!0}else h+=rM(o,p,o,l,n,s),h+=rM(u,l,u,p,n,s);break;case mA.Z:if(i){if(hM(c,d,u,p,e,n,s))return!0}else h+=rM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AM=function(t,e){return function(i,n){e(i,n,t)}};let kM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Yk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:vk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ze(Object.assign({defaultFontParams:{fontFamily:vk.fontFamily,fontSize:vk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ze.ALPHABET_CHAR_SET+ze.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var MM;kM=SM([Yw(),AM(0,Kw(tA)),AM(0,Xw(jk)),AM(1,Kw(aA)),wM("design:paramtypes",[Object,Object])],kM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(MM||(MM={}));const CM=new qt;let TM=class{constructor(){this.matrix=new qt}init(t){return this.mode=MM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=MM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(CM.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(CM.a,CM.b,CM.c,CM.d,CM.e,CM.f),this}scale(t,e,i){return this.mode===MM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return CM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(CM.a,CM.b,CM.c,CM.d,CM.e,CM.f),this}translate(t,e){return this.mode===MM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===MM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};TM=SM([Yw(),wM("design:paramtypes",[])],TM);const EM={arc:Sk,area:wk,circle:Ak,line:Ck,path:Tk,symbol:Bk,text:Ik,rect:Pk,rect3d:Rk,polygon:Ek,richtext:Dk,richtextIcon:Ok,image:Lk,group:kk,glyph:Mk},PM=Object.keys(EM);function RM(){return{arc:Object.assign({},EM.arc),area:Object.assign({},EM.area),circle:Object.assign({},EM.circle),line:Object.assign({},EM.line),path:Object.assign({},EM.path),symbol:Object.assign({},EM.symbol),text:Object.assign({},EM.text),rect:Object.assign({},EM.rect),rect3d:Object.assign({},EM.rect3d),polygon:Object.assign({},EM.polygon),richtext:Object.assign({},EM.richtext),richtextIcon:Object.assign({},EM.richtextIcon),image:Object.assign({},EM.image),group:Object.assign({},EM.group),glyph:Object.assign({},EM.glyph)}}function BM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const IM=new Array(60).fill(0).map((()=>RM()));class DM{constructor(){this._defaultTheme=IM.pop()||RM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?BM(this.userTheme,t.userTheme,!1):this.userTheme=P(t.userTheme),BM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);PM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const LM=new DM;function OM(t,e){return t.glyphHost?OM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):LM.getTheme()}return null}(t)||LM.getTheme()}class FM{static GenAutoIncrementId(){return FM.auto_increment_id++}}FM.auto_increment_id=0;var zM=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class HM extends r{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=FM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return zM(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(YM(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=YM(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=YM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=YM(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=GM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(YM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(YM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,YM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):YM(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof WM))return void console.warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i=0&&t<=C(this.rootTarget,"width")&&e>=0&&e<=C(this.rootTarget,"height")?this.rootTarget:null,i}}const $M={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof jM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new UM(t,e))}},KM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class qM{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new XM(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new VM,this.rootWheelEvent=new WM,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&f(t)&&!E(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class ZM{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const JM=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},QM=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class tC extends r{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=GM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=GM.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||JM(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=QM(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=GM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=QM(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=JM(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=GM.now()-i>this.config.press.time&&QM(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class iC{static Avaliable(){return!0}avaliable(){return iC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class nC{static Avaliable(){return!!Wk.global.getRequestAnimationFrame()}avaliable(){return nC.Avaliable()}tick(t,e){Wk.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var sC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(sC||(sC={}));class rC{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-rC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*rC.bounceIn(2*t):.5*rC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}rC.quadIn=rC.getPowIn(2),rC.quadOut=rC.getPowOut(2),rC.quadInOut=rC.getPowInOut(2),rC.cubicIn=rC.getPowIn(3),rC.cubicOut=rC.getPowOut(3),rC.cubicInOut=rC.getPowInOut(3),rC.quartIn=rC.getPowIn(4),rC.quartOut=rC.getPowOut(4),rC.quartInOut=rC.getPowInOut(4),rC.quintIn=rC.getPowIn(5),rC.quintOut=rC.getPowOut(5),rC.quintInOut=rC.getPowInOut(5),rC.backIn=rC.getBackIn(1.7),rC.backOut=rC.getBackOut(1.7),rC.backInOut=rC.getBackInOut(1.7),rC.elasticIn=rC.getElasticIn(1,.3),rC.elasticOut=rC.getElasticOut(1,.3),rC.elasticInOut=rC.getElasticInOut(1,.3*1.5);const aC=new class{constructor(){this.id=FM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===MA.END?this.removeAnimate(e):e.status===MA.RUNNING||e.status===MA.INITIAL?(this.animateCount++,e.advance(t)):e.status===MA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class oC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class lC extends oC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let hC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:FM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aC;this.id=t,this.timeline=e,this.status=MA.INITIAL,this.tailAnimate=new cC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&CA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:kA.ANIMATE_PLAY})}runCb(t){const e=new lC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===MA.RUNNING&&(this.status=MA.PAUSED)}resume(){this.status===MA.PAUSED&&(this.status=MA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new cC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===MA.RUNNING&&(this.status=MA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=MA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};hC.mode=CA.NORMAL,hC.interpolateMap=new Map;class cC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new dC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?rC[i]:i,s=this._addStep(e,null,n);return s.type=TA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?rC[i]:i,r=this._addStep(e,null,s);return r.type=TA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=TA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=TA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new dC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class dC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const uC=200,pC="cubicOut",gC=1e3,fC="quadInOut";var mC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(mC||(mC={}));const yC=[!1,!1,!1,!1],_C=[0,0,0,0],vC=t=>t?m(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(_C[0]=t[0],_C[2]=t[0],_C[1]=t[1],_C[3]=t[1],_C):t:t:0,bC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],xC=[1,2,3,0,1,2,3,0];function SC(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;bC[0].x=i,bC[1].y=i,bC[2].x=-i,bC[3].y=-i;const s=Math.ceil(t/At)%4,r=Math.ceil(e/At)%4;if(n.add(Et(t)*i,Bt(t)*i),n.add(Et(e)*i,Bt(e)*i),s!==r||e-t>wt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ht(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=wC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class PC extends oC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:kA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:kA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:kA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class RC extends PC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=Wk.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class BC extends PC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=Wk.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class IC extends oC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Mt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+wt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z}}class DC extends oC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class LC extends oC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?rC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function OC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function FC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{rt(e,n)&&rt(i,s)||t.push(e,i,n,s,n,s)};function WC(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function UC(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),KC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},qC=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return KC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return KC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);qC(s[0],n,i),qC(s[1],e-n,i)}};var ZC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const JC={};for(const t in ZC)E(ZC,t)&&(JC[ZC[t]]=t);const QC={to:{},get:{}};function tT(t,e,i){return Math.min(Math.max(e,t),i)}function eT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}QC.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=QC.get.hsl(t,n),i="hsl";break;case"hwb":e=QC.get.hwb(t,n),i="hwb";break;default:e=QC.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},QC.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=ZC[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=tT(e[n],0,255);return e[3]=tT(e[3],0,1),e},QC.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=tT(parseFloat(i[2]),0,100),e[2]=tT(parseFloat(i[3]),0,100),e[3]=tT(isNaN(t)?1:t,0,1),e}return null},QC.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=tT(parseFloat(i[2]),0,100),e[2]=tT(parseFloat(i[3]),0,100),e[3]=tT(isNaN(t)?1:t,0,1),e}return null},QC.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},QC.to.keyword=function(t){return JC[t.slice(0,3)]};const iT=QC;var nT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(nT||(nT={}));class sT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===nT.Color1){let e=sT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=QC.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];sT.store1[t]=s,sT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=sT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=QC.get(t),n&&n.value){const e=n.value;sT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],sT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===nT.Color1){if(sT.store1[t])return;sT.store1[t]=i,sT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(sT.store255[t])return;sT.store255[t]=i,sT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function rT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function aT(t,e,i,n,s){if(!t||!e)return t&&rT(t)||e&&rT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=sT.Get(t,nT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=sT.Get(e,nT.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:rT(a)})))});return o?aT(r,l,i,n,s):aT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:hT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:hT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:hT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),rT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}sT.store255={},sT.store1={};const oT=[0,0,0,0],lT=[0,0,0,0];function hT(t,e,i){return sT.Get(t,nT.Color255,oT),sT.Get(e,nT.Color255,lT),`rgba(${Math.round(oT[0]+(lT[0]-oT[0])*i)},${Math.round(oT[1]+(lT[1]-oT[1])*i)},${Math.round(oT[2]+(lT[2]-oT[2])*i)},${oT[3]+(lT[3]-oT[3])*i})`}const cT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=aT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},dT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?WC(t):[],s=WC(e);i&&n&&(i.fromTransform&&UC(n,i.fromTransform.clone().getInverse()),UC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},pT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],gT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!pT.includes(s))return;const r=e[s];h(r)||h(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?sT.Get(t[s],nT.Color255):t[s],to:"string"==typeof r?sT.Get(r,nT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class fT extends oC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;dT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&cT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const mT=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=uT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=gT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new fT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:gC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:fC)),c};class yT extends oC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;dT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&cT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const _T=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>kC.includes(t))(i)||(e[i]=t[i])})),e},vT=(t,e,i)=>{const n=_T(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Wk.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},bT=(t,e,i)=>{const n=[],s=i?null:_T(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:_T(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=YC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Wk.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=YC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Wk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=YC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Wk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return XC(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return XC(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Wk.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:$C(i)}];const n=[];return qC(i,e,n),n})(t,e).forEach((t=>{n.push(Wk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return qC(r,e,h),h})(t,e).forEach((t=>{n.push(Wk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=WC(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Wk.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Wk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&vT(t,n,e),n};class ST{static GetImage(t,e){var i;let n=ST.cache.get(t);n?"fail"===n.loadState?Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},ST.cache.set(t,n),n.dataPromise=Wk.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=ST.cache.get(t);n?"fail"===n.loadState?Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},ST.cache.set(t,n),n.dataPromise=Wk.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=ST.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},ST.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Wk.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Wk.global.loadBlob(t):"json"===e&&(i.dataPromise=Wk.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}ST.cache=new Map;const wT=new qt,AT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],kT=["x","y"],MT=["scaleX","scaleY"],CT=["angle"],TT=new Ht;class ET extends HM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Wt,this._updateTag=wA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=OM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;TT.x=i+e,TT.y=n+s}else TT.x=i,TT.y=n;return TT}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Wk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Wk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new qt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&wA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&wA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&wA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&wA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&wA.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&wA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=wA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===AA.GLOBAL){const i=new Ht(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Wk.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!h(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:uC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:pC)}else this.setAttributes(t,!1,{type:kA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();E(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=wA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=wA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=wA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&wA.UPDATE_SHAPE_AND_BOUNDS)===wA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=wA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=wA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=wA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=wA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=wA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=fk.x,y:e=fk.y,scaleX:i=fk.scaleX,scaleY:n=fk.scaleY,angle:s=fk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Et(a),f=Bt(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(fk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=wT.setValue(a.a,a.b,a.c,a.d,a.e,a.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Wk.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:kA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:kA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=aT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=aT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=aT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return OM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Wk.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return f(t,!0)?this.pathProxy=(new uk).fromString(t):this.pathProxy=new uk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",x(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(ST.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new UM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}ET.mixin($M);var PT=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function RT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let BT=0;function IT(){return BT++}const DT=IT(),LT=IT(),OT=IT(),FT=IT(),zT=IT(),HT=IT(),jT=IT(),NT=IT(),VT=IT(),WT=IT(),UT=IT(),GT=IT(),YT=IT(),XT=IT(),$T=IT(),KT=IT(),qT=Symbol.for("GraphicService"),ZT=Symbol.for("GraphicCreator");var JT;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(JT||(JT={}));let QT=class t extends ET{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=HT,this._childUpdateTag=wA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new DM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new DM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===AA.GLOBAL){const i=new Ht(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&wA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Wk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Wk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=OM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Wk.graphicService.updateGroupAABBBounds(t,OM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=vC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=wA.CLEAR_BOUNDS,this._childUpdateTag&=wA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=wA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&wA.UPDATE_BOUNDS||(this._childUpdateTag|=wA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Wk.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Wk.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Wk.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Wk.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Wk.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&wA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=Wk.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const tE=Symbol.for("LayerHandlerContribution");class eE extends QT{get offscreen(){return this.layerHandler.offscreen}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=Vk.get(tE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new DM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Wk.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Wk.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var iE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sE=function(t,e){return function(i,n){e(i,n,t)}};let rE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new eE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}};rE=iE([Yw(),sE(0,Kw(aA)),nE("design:paramtypes",[Object])],rE);var aE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lE=function(t,e){return function(i,n){e(i,n,t)}};const hE=Symbol.for("Window"),cE=Symbol.for("WindowHandlerContribution");let dE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new sA(["x","y","width","height"])},this._uid=FM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Vk.getNamed(cE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};aE([Qw(),oE("design:type",Function),oE("design:paramtypes",[]),oE("design:returntype",void 0)],dE.prototype,"postInit",null),dE=aE([Yw(),lE(0,Kw(aA)),oE("design:paramtypes",[Object])],dE);const uE=Symbol.for("TransformUtil"),pE=Symbol.for("GraphicUtil"),gE=Symbol.for("LayerService");var fE=new Nw((t=>{t(cA).toSelf().inSingletonScope(),t(aA).toService(cA),t(dE).to(dE),t(hE).toService(dE),t(kM).toSelf().inSingletonScope(),t(pE).toService(kM),t(TM).toSelf().inSingletonScope(),t(uE).toService(TM),t(rE).toSelf().inSingletonScope(),t(gE).toService(rE)}));function mE(t){return!!t}function yE(t,e){let i;return i=m(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function _E(t,e){return t*e>0}function vE(t,e,i,n){return t*e>0&&i>0&&n>0}function bE(t,e){return t*e>0}function xE(t,e,i,n){return t*e>0&&i>0&&n>0}function SE(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=OM(t,null==r?void 0:r.theme)[t.type],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible}=t.attribute,m=_E(d,u),y=bE(d,g),_=mE(h),v=yE(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return OA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function wE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function kE(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(s=Mt-St)e.moveTo(i+s*Et(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>St&&(e.moveTo(i+r*Et(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*Et(f),T=s*Bt(f),E=r*Et(y),P=r*Bt(y);let R,B,I,D;if((A>St||w>St)&&(R=s*Et(m),B=s*Bt(m),I=r*Et(_),D=r*Bt(_),hSt){const t=Rt(v,k),r=Rt(b,k),o=AE(I,D,C,T,s,t,Number(c)),l=AE(R,B,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Et(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+R,n+s*Bt(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>St)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>St){const t=Rt(S,M),s=Rt(x,M),o=AE(E,P,R,B,r,-s,Number(c)),l=AE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Et(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*Et(_),n+r*Bt(_))}return a?a[3]&&e.lineTo(i+s*Et(l),n+s*Et(l)):e.closePath(),d}class ME{static GetCanvas(){try{return ME.canvas||(ME.canvas=Wk.global.createCanvas({})),ME.canvas}catch(t){return null}}static GetCtx(){if(!ME.ctx){const t=ME.GetCanvas();ME.ctx=t.getContext("2d")}return ME.ctx}}class CE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=ME.GetCanvas(),n=ME.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=CE.dataMap.get(i);return n||(n=new CE(t,e),CE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){CE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return CE.dataMap.get(t)}}CE.dataMap=new Map;class TE{static GetSize(t){for(let e=0;e=t)return TE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=TE.GenKey(t,e,i,n,s),l=TE.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=TE.GenKey(t,e,i,n,s);TE.cache[l]?TE.cache[l].push({width:a,height:o,pattern:r}):TE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}TE.cache={},TE.ImageSize=[20,40,80,160,320,640,1280,2560];const EE=Symbol.for("ArcRenderContribution"),PE=Symbol.for("AreaRenderContribution"),RE=Symbol.for("CircleRenderContribution"),BE=Symbol.for("GroupRenderContribution"),IE=Symbol.for("ImageRenderContribution"),DE=Symbol.for("PathRenderContribution"),LE=Symbol.for("PolygonRenderContribution"),OE=Symbol.for("RectRenderContribution"),FE=Symbol.for("SymbolRenderContribution"),zE=Symbol.for("TextRenderContribution"),HE=Symbol.for("InteractiveSubRenderContribution");var jE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VE=function(t,e){return function(i,n){e(i,n,t)}};let WE=class{constructor(t){this.arcRenderContribitions=t,this.numberType=DT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Ct(d-c),p=d>c;let g=!1;if(sSt||M>St)&&(D=s*Et(v),L=s*Bt(v),O=r*Et(x),F=r*Bt(x),uSt){const t=Rt(S,T),r=Rt(w,T),a=AE(O,F,P,R,s,t,Number(p)),o=AE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>St)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>St){const t=Rt(k,E),s=Rt(A,E),a=AE(B,I,D,L,r,-s,Number(p)),o=AE(P,R,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Et(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,l){const h=OM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x:_=h.x,y:v=h.y}=t.attribute,b=_E(p,g),x=bE(p,m),S=mE(c),w=yE(u,f);if(!t.valid||!y)return;if(!(S||w||d))return;if(!(b||x||a||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=!1;const{isFullStroke:E,stroke:P}=(t=>{var e;let i=!0;if(o(t,!0)){for(let n=0;n<4;n++)yC[n]=t,i&&(i=!(null!==(e=yC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)yC[e]=!!t[e],i&&(i=!!yC[e]);else yC[0]=!1,yC[1]=!1,yC[2]=!1,yC[3]=!1;return{isFullStroke:i,stroke:yC}})(u);if(S||E||d){if(e.beginPath(),kE(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===RA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,_-i,v-n,h),e.fill())),w&&E&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,_-i,v-n,h),e.stroke()))}if(!E&&w){if(e.beginPath(),kE(t,e,i,n,A,k,P),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===RA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if(M&&C){const{startAngle:r,endAngle:o}=t.getParsedAngle();if(Ct(o-r)>=Mt-St){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:o=h.endAngle,fill:c=h.fill}=t.attribute,d=o;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===RA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),aT(o.color,l.color,h,!1)}(0,0,o,s);a||_E&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=OM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};WE=jE([Yw(),VE(0,Kw(tA)),VE(0,Xw(EE)),NE("design:paramtypes",[Object])],WE);var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},YE=function(t,e){return function(i,n){e(i,n,t)}};let XE=class{constructor(t){this.circleRenderContribitions=t,this.numberType=FT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=_E(y,f),w=bE(y,m),A=mE(h),k=yE(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};XE=UE([Yw(),YE(0,Kw(tA)),YE(0,Xw(RE)),GE("design:paramtypes",[Object])],XE);const $E=["radius","startAngle","endAngle",...AT];class KE extends ET{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=FT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=OM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Wk.graphicService.updateCircleAABBBounds(i,OM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=vC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).circle[t]}needUpdateTags(t){for(let e=0;e<$E.length;e++){const i=$E[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$E.length;e++)if(t===$E[e])return!0;return!1}toCustomPath(){var t,e,i;const n=this.attribute,s=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new uk;return o.arc(0,0,s,r,a),o}clone(){return new KE(Object.assign({},this.attribute))}}function qE(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function ZE(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function JE(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class QE{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=KT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=OM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=OM(this).text,n=Wk.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=ZE(c,s),e=JE(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=ZE(c,s),_=JE(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=OM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const g=Wk.graphicUtil.textMeasure,f=new QE(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).text[t]}needUpdateTags(t){for(let e=0;e{VP[t.type]=t}));const WP=["symbolType","size",...AT];let UP=class t extends ET{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=$T}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return m(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=OM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=VP[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new uk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Pt(r,a);return s.transform(0,0,o,o),this._parsedPath=new NP(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=OM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Wk.graphicService.updateSymbolAABBBounds(i,OM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=vC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=NT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=AC(i,n,e))}doUpdateAABBBounds(){const t=OM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateLineAABBBounds(e,OM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const XP=["width","height","cornerRadius",...AT];class $P extends ET{constructor(t){super(t),this.type="rect",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=OM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateRectAABBBounds(e,OM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).rect[t]}needUpdateTags(t){for(let e=0;e{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=Wk.graphicService.updateGlyphAABBBounds(this.attribute,OM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new ZP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const JP={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},QP=!0,tR=!1,eR=/\w|\(|\)/,iR=/[.?!,;:/,。?!、;:]/,nR=/\S/;function sR(t,e,i,n,s){if(!e||e<=0)return 0;const r=Wk.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=function(t,e){let i=e;for(;eR.test(t[i-1])&&eR.test(t[i])||iR.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function rR(t,e){const i=Wk.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class aR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=JP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class oR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=rR(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=rR(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=sR(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=rR(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||tR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||QP;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=sR(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=rR(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const lR=["width","height","image",...AT];class hR extends ET{constructor(t){super(t),this.type="image",this.numberType=jT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=OM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateImageAABBBounds(e,OM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lk[t]}needUpdateTags(t){for(let e=0;e{if(m(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=vC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Lk.width,height:e=Lk.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class dR{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof cR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=JP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof oR){const e=nR.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof cR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=rR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof cR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof cR)break;const{width:n}=rR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof cR?t.width:t.getWidthWithEllips(this.direction)})),e}}class uR{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=JP[this.direction]}store(t){if(t instanceof cR){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new dR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof cR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=sR(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new oR(i,t.newLine,t.character),new oR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const pR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...AT];class gR extends ET{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=XT}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dk.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Dk.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Dk.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Dk.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Dk.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Dk.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Dk.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Dk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=OM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateRichTextAABBBounds(e,OM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new uR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const fR=["path","customPath",...AT];class mR extends ET{constructor(t){super(t),this.type="path",this.numberType=VT}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=OM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof uk?e.path:(h(this.cache)&&this.doUpdatePathShape(),this.cache instanceof uk?this.cache:t.path)}doUpdateAABBBounds(){const t=OM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updatePathAABBBounds(e,OM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;f(t.path,!0)?this.cache=(new uk).fromString(t.path):t.customPath&&(this.cache=new uk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new _R(Object.assign({},this.attribute))}}const vR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...AT];class bR extends ET{constructor(t){super(t),this.type="arc",this.numberType=DT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=OM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(v(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=OM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Xt(e),i=e+r,n&&Ct(r)St&&o>St)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=OM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=It(n*n+s*s)}=this.attribute,o=Ct(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>St&&a>St){const i=e>t?1:-1;let r=Ot(Number(a)/s*Bt(u)),o=Ot(Number(a)/n*Bt(u));return(p-=2*r)>St?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>St?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=OM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Wk.graphicService.updateArcAABBBounds(i,OM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=vC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Mt-St)o.moveTo(0+s*Et(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>St&&(o.moveTo(0+n*Et(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Et(e),r=s*Bt(e),l=n*Et(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new bR(Object.assign({},this.attribute))}}class xR extends bR{constructor(t){super(t),this.type="arc3d",this.numberType=LT}doUpdateAABBBounds(){const t=OM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateArc3dAABBBounds(e,OM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const SR=["points","cornerRadius",...AT];class wR extends ET{constructor(t){super(t),this.type="polygon",this.numberType=WT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=OM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updatePolygonAABBBounds(e,OM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=AC(i,n,e))}getDefaultAttribute(t){return OM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new wR(Object.assign({},this.attribute))}}class AR extends wR{constructor(t){super(t),this.type="pyramid3d",this.numberType=UT}doUpdateAABBBounds(){const t=OM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updatePyramid3dAABBBounds(e,OM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var kR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let MR=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};MR=kR([Yw()],MR);var CR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const TR=Symbol.for("RectBoundsContribution");let ER=class extends MR{};ER=CR([Yw()],ER);var PR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const RR=Symbol.for("SymbolBoundsContribution");let BR=class extends MR{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;RT(i,n+r+o/2,!0,a)}return i}};BR=PR([Yw()],BR);var IR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const DR=Symbol.for("CircleBoundsContribution");let LR=class extends MR{};LR=IR([Yw()],LR);var OR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const FR=Symbol.for("ArcBoundsContribution");let zR=class extends MR{};zR=OR([Yw()],zR);var HR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const jR=Symbol.for("PathBoundsContribution");let NR=class extends MR{};NR=HR([Yw()],NR);class VR{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return VR.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XR=function(t,e){return function(i,n){e(i,n,t)}};function $R(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function KR(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function qR(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function ZR(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),$R(t,t,[s+o,r+l,a+h]),$R(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),$R(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=UR.allocate(),n=[0,0];if(y){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}$R(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),$R(i,i,[-n[0],-n[1],0]),qR(t,t,i)}}let JR=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new sA(["graphic"]),onSetStage:new sA(["graphic","stage"]),onRemove:new sA(["graphic"]),onAddIncremental:new sA(["graphic","group","stage"]),onClearIncremental:new sA(["graphic","group","stage"]),beforeUpdateAABBBounds:new sA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new sA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Wt,this.tempAABBBounds2=new Wt}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new uA(t);return OA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),Nt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Mt-St?i.set(-a,-a,a,a):SC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=St?i.set(0,0,0,0):Math.abs(a-o)>Mt-St?i.set(-s,-s,s,s):(SC(o,a,s,i),SC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(m(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){RT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){RT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Nt(e,e,s.transMatrix)}};JR=GR([Yw(),XR(0,Kw(ZT)),XR(1,Kw(tA)),XR(1,Xw(TR)),XR(2,Kw(tA)),XR(2,Xw(RR)),XR(3,Kw(tA)),XR(3,Xw(DR)),XR(4,Kw(tA)),XR(4,Xw(FR)),XR(5,Kw(tA)),XR(5,Xw(jR)),YR("design:paramtypes",[Object,Object,Object,Object,Object,Object])],JR);class QR extends QT{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const tB=["heightLimit","lineClamp"];class eB extends eP{_isValid(){const{text:t}=this.attribute;return m(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=OM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=Wk.graphicUtil.textMeasure,f=new QE(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=UR.allocate(),s=UR.allocate();ZR(s,t,e),qR(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),UR.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,y,_,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function bB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),xB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=EA.ROW:"y"===n?c=EA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wB=class extends vB{constructor(){super(...arguments),this.numberType=NT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const y=null!==(f=this.z)&&void 0!==f?f:0;bB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:y}),u.cache&&!m(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:_=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,_-c,v-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,_-c,v-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=_E(d,u),y=bE(d,p),_=mE(h),v=yE(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined),s=dk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=dk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],Rt(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function AB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),kB(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),kB(t,l,1,n),o=!1):o=!0}t.closePath()}function kB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=NA(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}wB=SB([Yw()],wB);var MB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TB=function(t,e){return function(i,n){e(i,n,t)}};function EB(t,e,i){switch(e){case"linear":default:return KA(t,i);case"basis":return JA(t,i);case"monotoneX":return rk(t,i);case"monotoneY":return ak(t,i);case"step":return lk(t,.5,i);case"stepBefore":return lk(t,0,i);case"stepAfter":return lk(t,1,i);case"linearClosed":return ck(t,i)}}let PB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=OT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=OM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=_E(y,m),A=mE(f),k=yE(b,x),M=bE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=EB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=EB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const r=EB(i,n),a=EB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],Rt(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=OM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?EA.ROW:EA.COLUMN,Number.isFinite(c)||(o=EA.COLUMN),Number.isFinite(d)||(o=EA.ROW);const u=i*(o===EA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===RA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,y-h,_-c,o),t.fill())),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;m(i)&&i[0]&&!1===i[1]&&(t.beginPath(),bB(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,y-h,_-c,o),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===RA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1}};PB=MB([Yw(),TB(0,Kw(tA)),TB(0,Xw(PE)),CB("design:paramtypes",[Object])],PB);var RB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IB=function(t,e){return function(i,n){e(i,n,t)}};let DB=class extends vB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=OM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=_E(f,p),w=bE(f,g),A=mE(d),k=yE(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)OA(t.pathShape.commandList,e,i,n,1,1,x);else{OA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};DB=RB([Yw(),IB(0,Kw(tA)),IB(0,Xw(DE)),BB("design:paramtypes",[Object])],DB);const LB=wt/2;function OB(t,e,i,n,s,r){let a;if(v(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!U(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-LB,0,!1)}if(t.lineTo(_[0],_[1]),!U(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,LB,!1)}if(t.lineTo(b[0],b[1]),!U(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],LB,wt,!1)}if(t.lineTo(g[0],g[1]),!U(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],wt,wt+LB,!1)}return t.closePath(),t}var FB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HB=function(t,e){return function(i,n){e(i,n,t)}};let jB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:y=l.fillOpacity,lineWidth:_=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=vE(f,y,u,p),A=xE(f,v,u,p),k=mE(h),M=yE(d,_);if(!t.valid||!b)return;if(!(k||M||c))return;if(!(w||A||a||o||c))return;0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),OB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};jB=FB([Yw(),HB(0,Kw(tA)),HB(0,Xw(OE)),zB("design:paramtypes",[Object])],jB);var NB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class extends vB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=$T}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=_E(f,p),A=bE(f,g),k=mE(d),M=yE(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};UB=NB([Yw(),WB(0,Kw(tA)),WB(0,Xw(FE)),VB("design:paramtypes",[Object])],UB);var GB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XB=function(t,e){return function(i,n){e(i,n,t)}};let $B=class extends vB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=_E(f,p),C=bE(f,g),T=mE(d),E=yE(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const P=!b,R=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===RA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,R,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,R);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,R,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,R);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,R))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,R),this.drawUnderLine(_,v,t,i,n+r,R,h,e)))}P&&this.restoreTransformUseContext2d(t,h,R,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=ZE(l,g),m=JE(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=ZE(h,a),f=JE("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};$B=GB([Yw(),XB(0,Kw(tA)),XB(0,Xw(zE)),YB("design:paramtypes",[Object])],$B);var KB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qB=class{};function ZB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iI=function(t,e){return function(i,n){e(i,n,t)}};let nI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:y=l.lineWidth,opacity:_=l.opacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=_E(_,p),w=bE(_,f),A=mE(c),k=yE(d,y);t.valid&&v&&(A||k||g)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||m(u)&&u.every((t=>0===t))?ZB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)ZB(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=QB(l,y,_,c,d),S=QB(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=JB(w,A),M=QB(l,JB(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};nI=tI([Yw(),iI(0,Kw(tA)),iI(0,Xw(LE)),eI("design:paramtypes",[Object])],nI);var sI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aI=function(t,e){return function(i,n){e(i,n,t)}};const oI=["","repeat-x","repeat-y","repeat"];let lI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a){const o=OM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=_E(d,u),_=mE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,oI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=OM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};lI=sI([Yw(),aI(0,Kw(tA)),aI(0,Xw(IE)),rI("design:paramtypes",[Object])],lI);const hI=Symbol.for("IncrementalDrawContribution"),cI=Symbol.for("ArcRender"),dI=Symbol.for("Arc3dRender"),uI=Symbol.for("AreaRender"),pI=Symbol.for("CircleRender"),gI=Symbol.for("GraphicRender"),fI=Symbol.for("GroupRender"),mI=Symbol.for("LineRender"),yI=Symbol.for("PathRender"),_I=Symbol.for("PolygonRender"),vI=Symbol.for("RectRender"),bI=Symbol.for("Rect3DRender"),xI=Symbol.for("SymbolRender"),SI=Symbol.for("TextRender"),wI=Symbol.for("RichTextRender"),AI=Symbol.for("Pyramid3dRender"),kI=Symbol.for("GlyphRender"),MI=Symbol.for("ImageRender"),CI=Symbol.for("RenderSelector"),TI=Symbol.for("DrawContribution");function EI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function PI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(m(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const RI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Yk(Object.assign({nativeCanvas:Wk.global.createCanvas(t)},t));const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr};return Yk(Object.assign({nativeCanvas:Wk.global.createCanvas(e)},e))}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};var BI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},II=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DI=function(t,e){return function(i,n){e(i,n,t)}};let LI=class{constructor(){this.time=RA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=OM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};LI=BI([Yw()],LI);let OI=class{constructor(t){this.subRenderContribitions=t,this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};OI=BI([Yw(),DI(0,Kw(tA)),DI(0,Xw(HE)),II("design:paramtypes",[Object])],OI);let FI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=RI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return RI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Mt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};FI=BI([Yw()],FI);var zI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=EI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),kE(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=EI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),kE(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};HI=zI([Yw()],HI);let jI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};jI=zI([Yw()],jI);let NI=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};NI=zI([Yw()],NI);var VI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=EI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=EI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};WI=VI([Yw()],WI);let UI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};UI=VI([Yw()],UI);let GI=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};GI=VI([Yw()],GI);var YI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let XI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};XI=YI([Yw()],XI);var $I=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=OM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};KI=$I([Yw()],KI);var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=EI(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),OB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=EI(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),OB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};ZI=qI([Yw()],ZI);let JI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};JI=qI([Yw()],JI);let QI=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};QI=qI([Yw()],QI);let tD=class{constructor(){this.time=RA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};tD=qI([Yw()],tD);let eD=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};eD=qI([Yw()],eD);var iD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let nD=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=EI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=EI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};nD=iD([Yw()],nD);class sD extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}}class rD extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}}var aD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lD=function(t,e){return function(i,n){e(i,n,t)}};const hD=Symbol.for("RenderService");let cD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};cD=aD([Yw(),lD(0,Kw(TI)),oD("design:paramtypes",[Object])],cD);var dD=new Nw((t=>{t(cD).toSelf(),t(hD).toService(cD)})),uD=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function pD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return uD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function fD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var mD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const yD=Symbol.for("PickItemInterceptor");let _D=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===LT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};_D=mD([Yw()],_D);var vD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xD=function(t,e){return function(i,n){e(i,n,t)}};const SD=Symbol.for("PickerService");let wD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new qt(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=UR.allocate();if(KR(i,e),a){if(i){const t=UR.allocate();r.modelMatrix=qR(t,a,i),UR.free(i)}}else KR(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Ht(e.x,e.y),a=OM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Ht(e.x,e.y);l.transformPoint(r,r);const a=OM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&UR.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),WR.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};wD=vD([Yw(),xD(0,Kw(aA)),xD(1,Kw(tA)),xD(1,Xw(yD)),bD("design:paramtypes",[Object,Object])],wD);var AD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},MD=function(t,e){return function(i,n){e(i,n,t)}};const CD=Symbol.for("GlobalPickerService");let TD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new qt(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Ht(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function ED(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function PD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}TD=AD([Yw(),MD(0,Kw(aA)),kD("design:paramtypes",[Object])],TD);class RD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=UR.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=UR.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ID=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const DD=[0,0,0],LD=new qt(1,0,0,1,0,0);let OD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},mk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},_k),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new qt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return WR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Mt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&TE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(PD(DD,[t,e,i],this.modelMatrix),t=DD[0],e=DD[1],i=DD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(PD(DD,[t,e,i],this.modelMatrix),t=DD[0],e=DD[1],i=DD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(PD(DD,[e,i,n],this.modelMatrix),e=DD[0],i=DD[1],n=DD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wk.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Wk.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:vk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:vk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(PD(DD,[e,i,n],this.modelMatrix),e=DD[0],i=DD[1],n=DD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=PI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=EI(this,l,this.dpr),r.strokeStyle=PI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=qE(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=qE(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(LD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>WR.free(t))),this.stack.length=0}};OD.env="browser",OD=BD([Yw(),ID("design:paramtypes",[Object,Number])],OD);var FD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const HD={WIDTH:500,HEIGHT:500,DPR:1};let jD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=HD.WIDTH,height:n=HD.HEIGHT,dpr:s=HD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=Wk.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new OD(this,this._dpr),this._id=e.id,this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};jD.env="browser",jD=FD([Yw(),zD("design:paramtypes",[Object])],jD);const ND=Symbol.for("CanvasArcPicker"),VD=Symbol.for("CanvasArc3dPicker"),WD=Symbol.for("CanvasAreaPicker"),UD=Symbol.for("CanvasCirclePicker"),GD=Symbol.for("CanvasImagePicker"),YD=Symbol.for("CanvasLinePicker"),XD=Symbol.for("CanvasPathPicker"),$D=Symbol.for("CanvasRectPicker"),KD=Symbol.for("CanvasRect3dPicker"),qD=Symbol.for("CanvasSymbolPicker"),ZD=Symbol.for("CanvasTextPicker"),JD=Symbol.for("CanvasPolygonPicker"),QD=Symbol.for("CanvasPyramid3dPicker"),tL=Symbol.for("CanvasRichTextPicker"),eL=Symbol.for("CanvasGlyphPicker"),iL=Symbol.for("CanvasPickerContribution"),nL=Symbol.for("MathArcPicker"),sL=Symbol.for("MathAreaPicker"),rL=Symbol.for("MathCirclePicker"),aL=Symbol.for("MathLinePicker"),oL=Symbol.for("MathPathPicker"),lL=Symbol.for("MathRectPicker"),hL=Symbol.for("MathSymbolPicker"),cL=Symbol.for("MathTextPicker"),dL=Symbol.for("MathPolygonPicker"),uL=Symbol.for("MathGlyphPicker"),pL=Symbol.for("MathPickerContribution");var gL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mL=function(t,e){return function(i,n){e(i,n,t)}};let yL=class extends wD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new jD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bL=new qt(1,0,0,1,0,0),xL={x:0,y:0};let SL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0),this.path=new uk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return WR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},xL),function(t,e,i){return xM(t,0,!1,e,i)}(this.path.commandList,xL.x,xL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},xL);const i=EI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return xM(t,e,!0,i,n)}(this.path.commandList,i,xL.x,xL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(bL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>WR.free(t))),this.stack.length=0}};SL=_L([Yw(),vL("design:paramtypes",[Object,Number])],SL);var wL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kL=function(t,e){return function(i,n){e(i,n,t)}};let ML=class extends wD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new SL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};wL([Qw(),AL("design:type",Function),AL("design:paramtypes",[]),AL("design:returntype",void 0)],ML.prototype,"init",null),ML=wL([Yw(),kL(0,Kw(tA)),kL(0,Xw(pL)),kL(1,Kw(aA)),kL(2,Kw(tA)),kL(2,Xw(yD)),AL("design:paramtypes",[Object,Object,Object])],ML);var CL=new Nw((t=>{t(yL).toSelf().inSingletonScope(),t(ML).toSelf().inSingletonScope(),t(SD).toService(yL),t(TD).toSelf().inSingletonScope(),t(CD).toService(TD),t(_D).toSelf().inSingletonScope(),t(yD).toService(_D),iA(t,yD)})),TL=new Nw((t=>{t(JR).toSelf().inSingletonScope(),t(qT).toService(JR),t(ER).toSelf().inSingletonScope(),t(TR).toService(ER),iA(t,TR),t(BR).toSelf().inSingletonScope(),t(RR).toService(BR),iA(t,RR),t(LR).toSelf().inSingletonScope(),t(DR).toService(LR),iA(t,DR),t(zR).toSelf().inSingletonScope(),t(FR).toService(zR),iA(t,FR),t(NR).toSelf().inSingletonScope(),t(jR).toService(NR),iA(t,jR),t(ZT).toConstantValue(fB)}));const EL=Symbol.for("AutoEnablePlugins"),PL=Symbol.for("PluginService");var RL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IL=function(t,e){return function(i,n){e(i,n,t)}};let DL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Vk.isBound(EL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};DL=RL([Yw(),IL(0,Kw(tA)),IL(0,Xw(EL)),BL("design:paramtypes",[Object])],DL);var LL=new Nw((t=>{t(DL).toSelf(),t(PL).toService(DL),iA(t,EL)})),OL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let FL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}};FL=OL([Yw()],FL);var zL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function jL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let NL=class extends FL{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(b(o)?o:1),y:(s-r.top)/(b(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return jL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return jL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:FM.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}};function VL(){Vk.rebind(SD).toService(ML)}NL=zL([Yw(),HL("design:paramtypes",[])],NL);var WL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GL=class extends FL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),VL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};GL=WL([Yw(),UL("design:paramtypes",[])],GL);var YL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $L=class extends FL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Vk.rebind(SD).toService(ML))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};$L=YL([Yw(),XL("design:paramtypes",[])],$L);var KL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZL=!1;try{ZL=!!lynx.createCanvasNG}catch(t){}let JL=class extends FL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=ZL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,ZL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),VL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};JL=KL([Yw(),qL("design:paramtypes",[])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tO=class extends FL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};tO=QL([Yw()],tO);var eO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let sO=class extends FL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return nO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{VL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};sO=eO([Yw(),iO("design:paramtypes",[])],sO);var rO=new Nw((t=>{t(NL).toSelf().inSingletonScope(),t(rA).toService(NL),t(GL).toSelf().inSingletonScope(),t(rA).toService(GL),t($L).toSelf().inSingletonScope(),t(rA).toService($L),t(JL).toSelf().inSingletonScope(),t(rA).toService(JL),t(sO).toSelf().inSingletonScope(),t(rA).toService(sO),t(tO).toSelf().inSingletonScope(),t(rA).toService(tO),iA(t,rA)})),aO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lO=class{constructor(){this._uid=FM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};lO=aO([Yw(),oO("design:paramtypes",[])],lO);var hO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dO=function(t,e){return function(i,n){e(i,n,t)}};let uO=class extends lO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:FM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new jD(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new jD({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};uO.env="browser",uO=hO([Yw(),dO(0,Kw(aA)),cO("design:paramtypes",[Object])],uO);var pO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gO=class extends OD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};gO.env="feishu",gO=pO([Yw()],gO);var fO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const yO={WIDTH:500,HEIGHT:500,DPR:1};let _O=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=yO.WIDTH,height:n=yO.HEIGHT,dpr:s=yO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new gO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};_O.env="feishu",_O=fO([Yw(),mO("design:paramtypes",[Object])],_O);var vO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xO=function(t,e){return function(i,n){e(i,n,t)}};let SO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new _O(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new _O({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};SO.env="feishu",SO=vO([Yw(),xO(0,Kw(aA)),bO("design:paramtypes",[Object])],SO);var wO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let AO=class extends OD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(PI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(EI(this,l,this.dpr)),r.setStrokeStyle(PI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=qE(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=qE(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};AO.env="taro",AO=wO([Yw()],AO);var kO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const CO={WIDTH:500,HEIGHT:500,DPR:1};let TO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=CO.WIDTH,height:n=CO.HEIGHT,dpr:s=CO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new AO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};TO.env="taro",TO=kO([Yw(),MO("design:paramtypes",[Object])],TO);var EO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RO=function(t,e){return function(i,n){e(i,n,t)}};let BO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new TO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new TO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};BO.env="taro",BO=EO([Yw(),RO(0,Kw(aA)),PO("design:paramtypes",[Object])],BO);var IO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let DO=class extends OD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=EI(this,l,this.dpr),r.strokeStyle=PI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};DO.env="lynx",DO=IO([Yw()],DO);var LO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const FO={WIDTH:500,HEIGHT:500,DPR:1};let zO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=FO.WIDTH,height:n=FO.HEIGHT,dpr:s=FO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new DO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};zO.env="lynx",zO=LO([Yw(),OO("design:paramtypes",[Object])],zO);var HO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NO=function(t,e){return function(i,n){e(i,n,t)}};let VO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new zO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};VO.env="lynx",VO=HO([Yw(),NO(0,Kw(aA)),jO("design:paramtypes",[Object])],VO);var WO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GO=class extends OD{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};GO.env="node",GO=WO([Yw(),UO("design:paramtypes",[Object,Number])],GO);var YO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const $O={WIDTH:500,HEIGHT:500,DPR:1};let KO=class{get id(){return this._id}get x(){return 0}get y(){return 0}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=$O.WIDTH,height:n=$O.HEIGHT,canvasControled:s=!0,dpr:r=$O.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new GO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&l(this._nativeCanvas.release)&&this._nativeCanvas.release()}};KO.env="node",KO=YO([Yw(),XO("design:paramtypes",[Object])],KO);var qO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JO=function(t,e){return function(i,n){e(i,n,t)}};let QO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new KO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new KO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};QO.env="node",QO=qO([Yw(),JO(0,Kw(aA)),ZO("design:paramtypes",[Object])],QO);var tF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eF=class extends OD{draw(){}createPattern(t,e){return null}};eF.env="wx",eF=tF([Yw()],eF);var iF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const sF={WIDTH:500,HEIGHT:500,DPR:1};let rF=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=sF.WIDTH,height:n=sF.HEIGHT,dpr:s=sF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new eF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};rF.env="wx",rF=iF([Yw(),nF("design:paramtypes",[Object])],rF);var aF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lF=function(t,e){return function(i,n){e(i,n,t)}};class hF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let cF=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new hF}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new rF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new rF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};cF.env="wx",cF=aF([Yw(),lF(0,Kw(aA)),oF("design:paramtypes",[Object])],cF);var dF=new Nw((t=>{t(uO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(uO))).whenTargetNamed(uO.env),t(SO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(SO))).whenTargetNamed(SO.env),t(BO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(BO))).whenTargetNamed(BO.env),t(VO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(VO))).whenTargetNamed(VO.env),t(cF).toSelf(),t(cE).toDynamicValue((t=>t.container.get(cF))).whenTargetNamed(cF.env),t(QO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(QO))).whenTargetNamed(QO.env)})),uF=new Nw((t=>{t(Nk).toSelf().inSingletonScope(),t(jk).toService(Nk),iA(t,jk)})),pF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fF=function(t,e){return function(i,n){e(i,n,t)}};let mF=class{constructor(t){this.global=t,this.offscreen=!1}init(t,e,i){if(this.layer=t,i.main)this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Yk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};mF=pF([Yw(),fF(0,Kw(aA)),gF("design:paramtypes",[Object])],mF);var yF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vF=function(t,e){return function(i,n){e(i,n,t)}};let bF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=Yk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};bF=yF([Yw(),vF(0,Kw(aA)),_F("design:paramtypes",[Object])],bF);var xF=new Nw((t=>{t(mF).toSelf(),t(bF).toSelf(),t(tE).toService(mF)}));var SF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const wF=Symbol.for("DrawItemInterceptor"),AF=new Wt;let kF=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){AF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(AF),!0}};kF=SF([Yw()],kF);let MF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=UR.allocate();KR(l,o);const h=r.modelMatrix;if(h){if(l){const t=UR.allocate();r.modelMatrix=qR(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===LT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&UR.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};MF=SF([Yw()],MF);var CF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EF=function(t,e){return function(i,n){e(i,n,t)}};let PF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=(h=l,c=n.dirtyBounds,d=!1,null===h?c:null===c?h:(ce=h.x1,de=h.x2,ue=h.y1,pe=h.y2,ge=c.x1,fe=c.x2,me=c.y1,ye=c.y2,d&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>=fe||de<=ge||ue>=ye||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ye)}));l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}var h,c,d;this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const u=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),u&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:xk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:xk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=fD(e,i,xk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(!xe(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):pD(t,xk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Vk.get(hI);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let BF=class{selector(t){return null}};BF=RF([Yw()],BF);var IF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LF=function(t,e){return function(i,n){e(i,n,t)}};let OF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=HT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:y=l.fillOpacity,strokeOpacity:_=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=vE(u,y,p,g),A=xE(u,_,p,g),k=mE(h),M=yE(d,x);if(!t.valid||!S)return;if(!f){if(!(k||M||c))return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===v||m(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),OB(e,i,n,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=OM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=UR.allocate(),i=UR.allocate();ZR(i,t,a),qR(e,o||e,i),s.modelMatrix=e,UR.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&UR.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};OF=IF([Yw(),LF(0,Kw(tA)),LF(0,Xw(BE)),DF("design:paramtypes",[Object])],OF);var FF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zF=class extends wB{constructor(){super(...arguments),this.numberType=NT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=OM(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,y=_E(u,p),_=bE(u,g),v=mE(c),b=yE(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};zF=FF([Yw()],zF);var HF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jF=class extends PB{constructor(){super(...arguments),this.numberType=OT}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=OM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=_E(u,d),f=mE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};jF=HF([Yw()],jF);var NF,VF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UF=function(t,e){return function(i,n){e(i,n,t)}},GF=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(NF||(NF={}));let YF=class extends PF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=NF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new sA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return GF(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:xk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:xk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return GF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return GF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>GF(this,void 0,void 0,(function*(){if(2!==t.count)yield gD(t,xk.zIndex,((i,n)=>{if(this.status===NF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return GF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return GF(this,void 0,void 0,(function*(){this.rendering&&(this.status=NF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=NF.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return GF(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>GF(this,void 0,void 0,(function*(){yield gD(t,xk.zIndex,(t=>GF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};VF([Kw(aA),WF("design:type",Object)],YF.prototype,"global",void 0),YF=VF([Yw(),UF(0,qw(gI)),UF(1,Kw(CI)),UF(2,Kw(zF)),UF(3,Kw(jF)),UF(4,Kw(gE)),UF(5,Kw(tA)),UF(5,Xw(wF)),WF("design:paramtypes",[Array,Object,Object,Object,Object,Object])],YF);var XF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $F=class extends vB{constructor(){super(...arguments),this.type="rect3d",this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=vE(g,f,u,p),x=xE(g,y,u,p),S=mE(c),w=yE(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=iT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=OM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};$F=XF([Yw()],$F);var KF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qF=class{constructor(){this.numberType=XT}drawShape(t,e,i,n,s){const r=OM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&_E(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=OM(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),OB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=OM(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};qF=KF([Yw()],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JF=class{constructor(){this.numberType=zT}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=OM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};JF=ZF([Yw()],JF);var QF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tz=class extends vB{constructor(){super(...arguments),this.numberType=LT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=_E(p,g),v=bE(p,m),b=mE(c),x=yE(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=iT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(r=Mt-St)e.moveTo(i+r*Et(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>St&&(e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*Et(p),_=r*Bt(p),v=a*Et(f),b=a*Bt(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>St)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Mt,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Ct(h-l),d=h>l;let u=!1;if(a<=St)e.moveTo(i,n,s);else if(c>=Mt-St)e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Et(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Et(c),f=a*Bt(c),m=a*Et(p),y=a*Bt(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=OM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};tz=QF([Yw()],tz);var ez=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iz=class extends vB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=UT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=_E(u,p),x=bE(u,f),S=mE(c),w=yE(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=iT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=OM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};iz=ez([Yw()],iz);var nz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sz=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};sz=nz([Yw()],sz);let rz=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};rz=nz([Yw()],rz);var az=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let oz=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};oz=az([Yw()],oz);let lz=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};lz=az([Yw()],lz);var hz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cz=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};cz=hz([Yw()],cz);let dz=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:MC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:MC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:MC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:MC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};dz=hz([Yw()],dz);var uz=new Nw((t=>{t(PF).toSelf(),t(TI).toService(PF),t(YF).toSelf(),t(hI).toService(YF),t(BF).toSelf(),t(CI).toService(BF),t(XE).toSelf().inSingletonScope(),t(pI).to(XE),t(gI).to(XE),t(WI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(GI).toSelf().inSingletonScope(),t(RE).toService(WI),t(RE).toService(UI),t(RE).toService(GI),iA(t,RE),t(jB).toSelf().inSingletonScope(),t(vI).to(jB),t(gI).to(jB),t($F).toSelf().inSingletonScope(),t(bI).toService($F),t(gI).toService(bI),t(ZI).toSelf().inSingletonScope(),t(JI).toSelf().inSingletonScope(),t(QI).toSelf().inSingletonScope(),t(tD).toSelf().inSingletonScope(),t(eD).toSelf().inSingletonScope(),t(OE).toService(ZI),t(OE).toService(JI),t(OE).toService(QI),t(OE).toService(tD),t(OE).toService(eD),iA(t,OE),t($B).toSelf().inSingletonScope(),t(SI).to($B),t(gI).to($B),iA(t,zE),t(DB).toSelf().inSingletonScope(),t(yI).to(DB),t(gI).to(DB),t(oz).toSelf().inSingletonScope(),t(lz).toSelf().inSingletonScope(),t(DE).toService(oz),t(DE).toService(lz),iA(t,DE),t(UB).toSelf().inSingletonScope(),t(xI).to(UB),t(gI).to(UB),t(nD).toSelf().inSingletonScope(),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(FE).toService(nD),t(FE).toService(sD),t(FE).toService(rD),iA(t,FE),t(WE).toSelf().inSingletonScope(),t(cI).to(WE),t(gI).to(WE),t(tz).toSelf().inSingletonScope(),t(dI).toService(tz),t(gI).toService(dI),t(HI).toSelf().inSingletonScope(),t(jI).toSelf().inSingletonScope(),t(NI).toSelf().inSingletonScope(),t(EE).toService(HI),t(EE).toService(jI),t(EE).toService(NI),iA(t,EE),t(wB).toSelf().inSingletonScope(),t(mI).to(wB),t(gI).to(wB),t(zF).toSelf().inSingletonScope(),t(jF).toSelf().inSingletonScope(),t(PB).toSelf().inSingletonScope(),t(uI).to(PB),t(gI).to(PB),t(cz).toSelf().inSingletonScope(),t(dz).toSelf().inSingletonScope(),t(PE).toService(cz),t(PE).toService(dz),iA(t,PE),t(OF).toSelf().inSingletonScope(),t(fI).to(OF),t(gI).to(OF),t(XI).toSelf().inSingletonScope(),t(BE).toService(XI),iA(t,BE),t(nI).toSelf().inSingletonScope(),t(_I).to(nI),t(gI).to(nI),t(sz).toSelf().inSingletonScope(),t(rz).toSelf().inSingletonScope(),t(LE).toService(sz),t(LE).toService(rz),iA(t,LE),t(JF).toSelf().inSingletonScope(),t(kI).toService(JF),t(gI).toService(kI),t(lI).toSelf().inSingletonScope(),t(MI).toService(lI),t(gI).toService(MI),t(KI).toSelf().inSingletonScope(),t(IE).toService(KI),iA(t,IE),t(qF).toSelf().inSingletonScope(),t(wI).toService(qF),t(gI).toService(wI),t(iz).toSelf().inSingletonScope(),t(AI).toService(iz),t(gI).toService(AI),t(OI).toSelf().inSingletonScope(),t(zE).toService(OI),t(EE).toService(OI),t(DE).toService(OI),t(FE).toService(OI),t(OE).toService(OI),t(IE).toService(OI),t(RE).toService(OI),t(PE).toService(OI),t(LE).toService(OI),iA(t,HE),iA(t,gI),t(kF).toSelf().inSingletonScope(),t(wF).toService(kF),t(MF).toSelf().inSingletonScope(),t(wF).toService(MF),iA(t,wF)}));var pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fz=function(t,e){return function(i,n){e(i,n,t)}};let mz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=FT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=EI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};mz=pz([Yw(),fz(0,Kw(pI)),gz("design:paramtypes",[Object])],mz);var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};const bz=new Wt;let xz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=EI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;bz.setValue(i.x1,i.y1,i.x2,i.y2),bz.expand(-r/2),h=!bz.containsPoint(e)}}return n.highPerformanceRestore(),h}};xz=yz([Yw(),vz(0,Kw(vI)),_z("design:paramtypes",[Object])],xz);var Sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Az=function(t,e){return function(i,n){e(i,n,t)}};let kz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=DT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=EI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kz=Sz([Yw(),Az(0,Kw(cI)),wz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=OT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Ez=Mz([Yw(),Tz(0,Kw(uI)),Cz("design:paramtypes",[Object])],Ez);var Pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Rz=class{constructor(){this.type="image",this.numberType=jT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Rz=Pz([Yw()],Rz);var Bz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Iz=class extends vB{};Iz=Bz([Yw()],Iz);var Dz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oz=function(t,e){return function(i,n){e(i,n,t)}};let Fz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=OM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=EI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Fz=Dz([Yw(),Oz(0,Kw(mI)),Lz("design:paramtypes",[Object])],Fz);var zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=EI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Nz=zz([Yw(),jz(0,Kw(yI)),Hz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Gz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=$T}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=OM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=EI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Gz=Vz([Yw(),Uz(0,Kw(xI)),Wz("design:paramtypes",[Object])],Gz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$z=function(t,e){return function(i,n){e(i,n,t)}};let Kz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=KT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=OM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=JE(a,u,s),y=ZE(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&UR.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Kz=Yz([Yw(),$z(0,Kw(SI)),Xz("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};let Qz=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=WT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Qz=qz([Yw(),Jz(0,Kw(_I)),Zz("design:paramtypes",[Object])],Qz);var tH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let nH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=XT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nH=tH([Yw(),iH(0,Kw(wI)),eH("design:paramtypes",[Object])],nH);var sH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aH=function(t,e){return function(i,n){e(i,n,t)}};let oH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};oH=sH([Yw(),aH(0,Kw(kI)),rH("design:paramtypes",[Object])],oH);var lH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let dH=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=YT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};dH=lH([Yw(),cH(0,Kw(bI)),hH("design:paramtypes",[Object])],dH);var uH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let fH=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};fH=uH([Yw(),gH(0,Kw(AI)),pH("design:paramtypes",[Object])],fH);var mH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_H=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let vH=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=LT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};vH=mH([Yw(),_H(0,Kw(dI)),yH("design:paramtypes",[Object])],vH);var bH=new Nw(((t,e,i,n)=>{t(mz).toSelf().inSingletonScope(),t(UD).toService(mz),t(iL).toService(UD),t(xz).toSelf().inSingletonScope(),t($D).toService(xz),t(iL).toService($D),t(dH).toSelf().inSingletonScope(),t(KD).toService(dH),t(iL).toService(KD),t(kz).toSelf().inSingletonScope(),t(ND).toService(kz),t(iL).toService(ND),t(Ez).toSelf().inSingletonScope(),t(WD).toService(Ez),t(iL).toService(WD),t(Rz).toSelf().inSingletonScope(),t(GD).toService(Rz),t(iL).toService(GD),t(Fz).toSelf().inSingletonScope(),t(YD).toService(Fz),t(iL).toService(YD),t(Nz).toSelf().inSingletonScope(),t(XD).toService(Nz),t(iL).toService(XD),t(Gz).toSelf().inSingletonScope(),t(qD).toService(Gz),t(iL).toService(qD),t(Kz).toSelf().inSingletonScope(),t(ZD).toService(Kz),t(iL).toService(ZD),t(Qz).toSelf().inSingletonScope(),t(JD).toService(Qz),t(iL).toService(JD),t(fH).toSelf().inSingletonScope(),t(QD).toService(fH),t(iL).toService(QD),t(vH).toSelf().inSingletonScope(),t(VD).toService(vH),t(iL).toService(VD),t(nH).toSelf().inSingletonScope(),t(tL).toService(nH),t(iL).toService(tL),t(oH).toSelf().inSingletonScope(),t(eL).toService(oH),t(iL).toService(eL),iA(t,iL)})),xH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wH=function(t,e){return function(i,n){e(i,n,t)}};let AH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};AH=xH([Yw(),wH(0,Kw(yI)),SH("design:paramtypes",[Object])],AH);var kH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CH=function(t,e){return function(i,n){e(i,n,t)}};let TH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=FT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};TH=kH([Yw(),CH(0,Kw(pI)),MH("design:paramtypes",[Object])],TH);var EH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RH=function(t,e){return function(i,n){e(i,n,t)}};const BH=new Wt;let IH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;BH.setValue(i.x1,i.y1,i.x2,i.y2),BH.expand(-r/2),h=!BH.containsPoint(e)}}return n.highPerformanceRestore(),h}};IH=EH([Yw(),RH(0,Kw(vI)),PH("design:paramtypes",[Object])],IH);var DH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OH=function(t,e){return function(i,n){e(i,n,t)}};let FH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=DT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};FH=DH([Yw(),OH(0,Kw(cI)),LH("design:paramtypes",[Object])],FH);var zH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jH=function(t,e){return function(i,n){e(i,n,t)}};let NH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=OT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};NH=zH([Yw(),jH(0,Kw(uI)),HH("design:paramtypes",[Object])],NH);var VH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let GH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};GH=VH([Yw(),UH(0,Kw(mI)),WH("design:paramtypes",[Object])],GH);var YH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$H=function(t,e){return function(i,n){e(i,n,t)}};let KH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=$T}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};KH=YH([Yw(),$H(0,Kw(xI)),XH("design:paramtypes",[Object])],KH);var qH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZH=class{constructor(){this.type="text",this.numberType=KT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};ZH=qH([Yw()],ZH);var JH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tj=function(t,e){return function(i,n){e(i,n,t)}};let ej=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=WT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ej=JH([Yw(),tj(0,Kw(_I)),QH("design:paramtypes",[Object])],ej);var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sj=function(t,e){return function(i,n){e(i,n,t)}};let rj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};rj=ij([Yw(),sj(0,Kw(kI)),nj("design:paramtypes",[Object])],rj);var aj=new Nw((t=>{t(TH).toSelf().inSingletonScope(),t(rL).toService(TH),t(pL).toService(rL),t(IH).toSelf().inSingletonScope(),t(lL).toService(IH),t(pL).toService(lL),t(FH).toSelf().inSingletonScope(),t(nL).toService(FH),t(pL).toService(nL),t(NH).toSelf().inSingletonScope(),t(sL).toService(NH),t(pL).toService(sL),t(GH).toSelf().inSingletonScope(),t(aL).toService(GH),t(pL).toService(aL),t(AH).toSelf().inSingletonScope(),t(oL).toService(AH),t(pL).toService(oL),t(KH).toSelf().inSingletonScope(),t(hL).toService(KH),t(pL).toService(hL),t(ZH).toSelf().inSingletonScope(),t(cL).toService(ZH),t(pL).toService(cL),t(ej).toSelf().inSingletonScope(),t(dL).toService(ej),t(pL).toService(dL),t(rj).toSelf().inSingletonScope(),t(uL).toService(rj),t(rj).toService(uL),iA(t,pL)}));var oj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new jD(t))).whenTargetNamed(jD.env),t(Gk).toDynamicValue((()=>(t,e)=>new OD(t,e))).whenTargetNamed(OD.env)})),lj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new TO(t))).whenTargetNamed(TO.env),t(Gk).toDynamicValue((()=>(t,e)=>new AO(t,e))).whenTargetNamed(AO.env)})),hj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new _O(t))).whenTargetNamed(_O.env),t(Gk).toDynamicValue((()=>(t,e)=>new gO(t,e))).whenTargetNamed(gO.env)})),cj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new zO(t))).whenTargetNamed(zO.env),t(Gk).toDynamicValue((()=>(t,e)=>new DO(t,e))).whenTargetNamed(DO.env)})),dj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new rF(t))).whenTargetNamed(rF.env),t(Gk).toDynamicValue((()=>(t,e)=>new eF(t,e))).whenTargetNamed(eF.env)})),uj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new KO(t))).whenTargetNamed(KO.env),t(Gk).toDynamicValue((()=>(t,e)=>new GO(t,e))).whenTargetNamed(GO.env)}));Vk.load(fE),Vk.load(TL),Vk.load(dD),Vk.load(CL),Vk.load(LL),function(t){t.load(rO),t.load(dF),t.load(uF),t.load(xF)}(Vk),function(t){t.load(uz)}(Vk),function(t){t.load(bH),t.load(aj)}(Vk),function(t){t.load(oj),t.load(hj),t.load(lj),t.load(cj),t.load(dj),t.load(uj)}(Vk);const pj=Vk.get(aA);Wk.global=pj;const gj=Vk.get(pE);Wk.graphicUtil=gj;const fj=Vk.get(uE);Wk.transformUtil=fj;const mj=Vk.get(qT);Wk.graphicService=mj,Vk.get(CD);const yj=Vk.get(gE);Wk.layerService=yj;class _j{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Wk.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Wk.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Wk.graphicService.hooks.onAttributeUpdate.taps=Wk.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.onSetStage.taps=Wk.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class vj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class bj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Wk.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Wk.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Wk.graphicService.hooks.onAddIncremental.taps=Wk.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.onClearIncremental.taps=Wk.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Wk.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const xj=new Wt;class Sj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Wk.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(xj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(xj,t.parent&&t.parent.globalTransMatrix)))})),Wk.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),Wk.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Wk.graphicService.hooks.beforeUpdateAABBBounds.taps=Wk.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.afterUpdateAABBBounds.taps=Wk.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.onRemove.taps=Wk.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const wj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===sC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=sC.INITIAL,Wk.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Wk.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:nC},{mode:"timeout",cons:iC},{mode:"manual",cons:eC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==sC.INITIAL&&(this.status=sC.PAUSE,!0)}resume(){return this.status!==sC.INITIAL&&(this.status=sC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===sC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===sC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=sC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=sC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};wj.addTimeline(aC),wj.setFPS(60);class Aj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=iT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=It(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Rt(Pt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=f(e)?iT.get(e).value:e;const r=this.colorRgb;return iT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const kj="white";class Mj extends QT{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:kj}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new DM,this.hooks={beforeRender:new sA(["stage"]),afterRender:new sA(["stage"])},this.global=Vk.get(aA),this.window=Vk.get(hE),this.renderService=Vk.get(hD),this.pickerService=Vk.get(SD),this.pluginService=Vk.get(PL),this.layerService=Vk.get(gE),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Wt,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:kj,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new qM({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||wj,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new Aj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new RD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new vj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new _j))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new bj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new Sj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive"}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Ht(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Vk.get(hE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Cj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Cj||(Cj={}));const Tj="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Ej=Tj,Pj=14,Rj=18,Bj=4,Ij={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Pj}}},Dj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Lj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Pj,offset:12,position:"outside"}}},Oj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Pj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Pj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Pj,fill:"#707070",textBaseline:"middle"}}},Fj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Pj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Pj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Pj,fill:"#707070",textBaseline:"middle"}}},zj="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",Hj={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:zj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:zj,fill:"#ddd"}}},jj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Nj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Vj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Pj,fontWeight:"normal",fillOpacity:1}}},Wj={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Pj}}},Uj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Gj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Yj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Pj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Pj}}},Xj={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Pj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Pj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Pj,textBaseline:"middle",textAlign:"center"}}},$j="__VCHART",Kj=500,qj=500,Zj=`${$j}_LABEL_LIMIT`,Jj=`${$j}_LABEL_ALIGN`,Qj=`${$j}_LABEL_TEXT`,tN=`${$j}_LABEL_VISIBLE`,eN=`${$j}_LABEL_X`,iN=`${$j}_LABEL_Y`,nN=`${$j}_ARC_RATIO`,sN=`${$j}_ARC_START_ANGLE`,rN=`${$j}_ARC_END_ANGLE`,aN=`${$j}_ARC_K`,oN=`${$j}_ARC_LABEL_HOVER_AX`,lN=`${$j}_ARC_LABEL_HOVER_AY`,hN=`${$j}_ARC_LABEL_POINT_AX`,cN=`${$j}_ARC_LABEL_POINT_AY`,dN=`${$j}_ARC_LABEL_POINT_BX`,uN=`${$j}_ARC_LABEL_POINT_BY`,pN=`${$j}_ARC_LABEL_POINT_CX`,gN=`${$j}_ARC_LABEL_POINT_CY`,fN=`${$j}_ARC_LABEL_SELECTED_AX`,mN=`${$j}_ARC_LABEL_SELECTED_AY`,yN=`${$j}_ARC_MIDDLE_ANGLE`,_N=`${$j}_ARC_QUADRANT`,vN=`${$j}_ARC_RADIAN`,bN=-Math.PI/2,xN=3*Math.PI/2,SN=-90,wN=270,AN=.6,kN={},MN=[],CN=(t,e,i)=>{kN[t]=Object.assign(e,{type:t}),i||MN.push(t)},TN=()=>{MN.slice().forEach((t=>{(t=>{delete kN[t];const e=MN.indexOf(t);e>=0&&MN.splice(e,1)})(t)}))};function EN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:f(t)?t:h(s=t)?null:s.fname})):null}function PN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function RN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const BN=":vGrammar_identifier:";function IN(t,e){return N(t).reduce(((t,i)=>{const n=f(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function DN(t,e){if(h(t))return[];if(!l(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(f(i))return N(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!l(t)&&!!(null==t?void 0:t.callback)}(t))return IN(t.dependency,e);var i;return[]}function LN(t){return l(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function ON(t,e,i,n){if(h(t))return t;if(l(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return f(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function FN(t,e){return zN(t)?t.output():e[t]}const zN=t=>t&&!h(t.grammarType),HN=t=>l(t)?t:e=>e[t],jN=t=>f(t)&&se.parseColorString(t)?t:null;function NN(t){return!!(null==t?void 0:t.scale)}function VN(t){return!!(null==t?void 0:t.field)}function WN(t,e){if(!t)return[];let i=[];return t.scale&&(i=zN(t.scale)?[t.scale]:N(e.getScaleById(t.scale))),i.concat(DN(t,e))}class UN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return f(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=N(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const GN={},YN=t=>GN[t],XN=(t,e,i,n,s)=>(GN[t]=new UN(e,i,n,s),GN[t]);function $N(t){return null===t?0:t}function KN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const qN=["fillOpacity","x","y","dx","dy"],ZN=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=$N(i.x),["x"]):"y"===e?(t.y=$N(i.y),["y"]):"dx"===e?(t.dx=$N(i.dx),["dx"]):"dy"===e?(t.dy=$N(i.dy),["dy"]):[]};var JN,QN,tV,eV,iV,nV,sV,rV,aV,oV,lV,hV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(JN||(JN={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(QN||(QN={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(tV||(tV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(eV||(eV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(iV||(iV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(nV||(nV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(sV||(sV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(rV||(rV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(aV||(aV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oV||(oV={})),function(t){t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd"}(lV||(lV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(hV||(hV={}));const cV={[QN.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),b(e.length)||!b(e.z1)&&b(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):b(e.z1)||!b(e.length)&&b(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[QN.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[QN.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return b(e)&&b(i)&&b(n)&&b(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[QN.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const dV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=f(t)?cV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(qN.includes(r)?ZN(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{qN.includes(t)?ZN(s,t,e):s[t]=e[t]}));return s},uV=(t,e,i)=>!(!h(t)||!h(e))||!h(t)&&!h(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(f(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function pV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case QN.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case QN.group:case QN.rect:case QN.image:return["width","height","y1"].includes(e);case QN.path:case QN.shape:return["path","customPath"].includes(e);case QN.line:return"defined"===e;case QN.area:return["x1","y1","defined"].includes(e);case QN.rule:return["x1","y1"].includes(e);case QN.symbol:return"size"===e;case QN.polygon:return"points"===e;case QN.text:return"text"===e}return!1}function gV(t,e,i,n,s){i&&(LN(i)?e.forEach((e=>{const s=ON(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],c=s&&!pV(t.mark.markType,r)?[e[0]]:e;if(NN(l)){const t=FN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!h(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=f(null==l?void 0:l.field),d=s?ol(l.field):null;let u=s?null:h(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=v(u)||v(i)?u+e+i:u}))}else if(VN(l)){const t=ol(l.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=ON(l,n,e.datum,t)}))})))}function fV(t,e,i,n){if(!t)return null;if(LN(t))return ON(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const c=t[r];if(NN(c)){const t=FN(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!h(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=f(null==c?void 0:c.field),p=u?ol(c.field):null,g=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):h(null==c?void 0:c.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,c.value);s[r]=v(g)||v(d)?g+i+d:g}else if(VN(c)){const t=ol(c.field);s[r]=t(e)}else s[r]=ON(c,n,e,i)})),s}function mV(t){if(t)return t.type===Ol.Band?t.bandwidth():t.type===Ol.Point?t.step():void 0}const yV={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=l(i)?i:ul(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!h(s)){if(h(t))return;t[s]=e}return e})),e;const r=n(e,i);return h(s)||h(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=Ve.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=ol(a),c=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),d=h(t.default)?null:t.default,u=s.map((t=>ol(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),h(n)&&(n=o);const t=o.map((t=>ol(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],l=o.length;return(h(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=h(r)?d:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=EN(i,t.as||[]),s=i.map((t=>f(t)?ol(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Y(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],x=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),w=b(S*_)?S/_:null,A=b(_*_)?_/x:null;return d&&(y[d]=x),p&&(y[p]=S),r&&(y[r]=w),a&&(y[a]=0===i?1:A),o&&(y[o]=!0===g?w:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:S/v[1]),c&&(y[c]=0===i?1:x/v[1]),u&&(y[u]=_),y}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=PN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=RN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return RN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;h(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=h(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=h(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{h(n[BN])&&(n[BN]=0);let s=n[BN];const r=t.as;return e.forEach((t=>{t&&h(t[r])&&(s+=1,t[r]=s)})),n[BN]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=mV(a.y),l="y"===t.dodgeChannel||h(t.dodgeChannel)&&o>0?"y":"x",c="y"===l?o:mV(a.x);if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!h(t.dodgeBy)){const e=sl(N(t.dodgeBy));o=t=>e(t.getDatum())}const d=[];e.forEach((t=>{const e=o(t);d.includes(e)||d.push(e)}));const u=d.length;if(u<1)return e;const p=fl(a,c);let g=p>=c?c:c-p;const f=fl(i,g);let m=(g-Math.max(u-1,0)*f)/u;m>t.maxWidth?(g-=(m-t.maxWidth)*u,m=t.maxWidth):m{y[t]=-g/2+e*(m+f)}));const _=r.markType;"rect"===_||"interval"===_?e.forEach((t=>{const e=o(t),i=y[e],n=t.getItemAttribute();if("x"===l){const e={x:(h(n.width)&&!h(n.x1)?Math.min(n.x,n.x1):n.x)+(h(n.width)?h(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};h(n.width)?e.x1=e.x+m:e.width=m,t.setItemAttributes(e)}else if("y"===l){const e={y:(h(n.height)&&!h(n.y1)?Math.min(n.y,n.y1):n.y)+(h(n.height)?h(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};h(n.height)?e.y1=e.y+m:e.height=m,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=y[e];if("x"===l){const e=t.getItemAttribute("x")+c/2;t.setItemAttributes({x:e+i+m/2})}else if("y"===l){const e=t.getItemAttribute("y")+c/2;t.setItemAttributes({y:e+i+m/2})}}))}return e},markPhase:"afterEncodeItems"}},_V="__vgrammar_scene_item__",vV=[QN.line,QN.area],bV=[QN.arc3d,QN.rect3d,QN.pyramid3d],xV="key",SV=[{}],wV=["key"],AV="VGRAMMAR_IMMEDIATE_ANIMATION",kV=0,MV=1e3,CV=0,TV=!1,EV=!1,PV="quintInOut",RV={stopWhenStateChange:!1,immediatelyApply:!0},BV={},IV=t=>BV[t],DV=(t,e)=>{BV[t]={creator:e}};class LV extends QT{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new uk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Bk.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new uk;let a,o;r.clear();const l=v(s)?s:Pt(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(lV.BEFORE_CREATE_VRENDER_MARK),e===QN.largeRects)return new LV(i);if(e===QN.largeSymbols)return new OV(i);const n=FV[e]?FV[e](i):IV(e)?IV(e).creator(i):null;return t.emit(lV.AFTER_CREATE_VRENDER_MARK),n}function HV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(lV.BEFORE_CREATE_VRENDER_MARK);const n=new ZP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=FV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(lV.AFTER_CREATE_VRENDER_MARK),n}const jV=t=>{t&&(t[_V]=null,t.release(),t.parent&&t.parent.removeChild(t))};class NV{constructor(t){this.data=null,this.states=[],this.diffState=JN.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if(l(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));gV(this,o,a,this.mark.parameters());const h=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[_V]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?dV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),h(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===JN.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(lV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=HN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(lV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=N(ON(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===JN.unChange&&(this.diffState=JN.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==JN.enter&&this.diffState!==JN.update||!this.states.length||this.useStates(this.states),this.mark.markType===QN.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new uk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===JN.enter?(r&&gV(this,t,r,i,o),s&&gV(this,t,s,i,o)):this.diffState===JN.update?(n&&r&&gV(this,t,r,i,o),s&&gV(this,t,s,i,o)):this.diffState===JN.exit&&a&&gV(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=o(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=N(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&f(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=N(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(lV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=o(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(lV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)gl(n,i,t)&&E(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let c=null==l?void 0:l.nextAttrs;if(t&&t.length&&h(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||KN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[QN.line,QN.area,QN.largeRects,QN.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===QN.line||e===QN.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>KN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=$N(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=$N(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=$N(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=$N(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===QN.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>uV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=dV(QN.line,t.attrs,i);return n.points=e.slice(t.startIndex,h(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?Object.assign(c,{segments:e,points:null}):Object.assign(c,{points:t,segments:null})}else p?Object.assign(c,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(c,{points:s,segments:null})}else e===QN.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=$N(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=$N(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=$N(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=$N(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===QN.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=$N(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=$N(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!M(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!h(e=C(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return C(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!E(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!E(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(jV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(jV(this.graphicItem),this.graphicItem[_V]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?h(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):h(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?m(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const VV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(b(e.center.x)&&(s.x=e.center.x),b(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},WV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),UV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const GV=["visible","path","text","lineWidth","textBaseline","textAlign"],YV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:c+u/2,width:h(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:d+p/2,height:h(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:c+u/2,x1:c+u/2,y:d+p/2,y1:d+p/2,width:h(o)?void 0:0,height:h(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:h(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:h(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:h(n)?void 0:0,height:h(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:h(n)?void 0:0}}:{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:h(n)?void 0:0}}:{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:VV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:VV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:WV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WV(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:UV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:UV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return GV.forEach((t=>{delete n[t],delete s[t]})),N(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{gl(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},XV=Object.assign({},YV),$V=t=>XV[t],KV=(t,e)=>{XV[t]=e},qV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.from.min=l,m.to.min=d),b(u)&&(m.from.max=l,m.to.max=u),b(p)&&(m.from.q1=l,m.to.q1=p),b(g)&&(m.from.q3=l,m.to.q3=g),b(f)&&(m.from.median=l,m.to.median=f),m},ZV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.to.min=l,m.from.min=d),b(u)&&(m.to.max=l,m.from.max=u),b(p)&&(m.to.q1=l,m.from.q1=p),b(g)&&(m.to.q3=l,m.from.q3=g),b(f)&&(m.to.median=l,m.from.median=g),m},JV=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(b(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return b(f)?f:b(_)&&b(v)?(_+v)/2:b(m)&&b(y)?(m+y)/2:b(y)?y:b(m)?m:NaN},QV=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),b(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(b(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),b(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const tW=(t,e,i)=>{var n,s,r,a;if(b(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return b(o)?o:b(c)&&b(d)?(c+d)/2:b(l)&&b(h)?(l+h)/2:b(h)?h:b(l)?l:NaN},eW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),b(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(b(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),b(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const iW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},nW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},sW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?nW:iW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},rW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},aW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},oW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function lW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(xV,i?t.slice().sort(i):t.slice()),{keys:wV,data:n};const s=HN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class hW{constructor(t,e,i){this.prevData=lW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const cW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=KN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=KN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const dW=(t,e,i,n,s)=>l(i)?i(t.getDatum(),t,s):i;class uW extends oC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class pW extends oC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{h(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:kA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:kA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}hC.mode|=CA.SET_ATTR_IMMEDIATELY;let gW=0;const fW=t=>!h(t)&&t.prototype instanceof oC;class mW{constructor(t,e,i){this.id=gW++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),b(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=l(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!$V(e.type))return null;const r=$V(e.type)(t,s,i);return cW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return m(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):d(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!h(null===(r=s[i])||void 0===r?void 0:r.from),l=!h(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?dW(t,0,s[i].from,0,n):void 0,e.to[i]=l?dW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),cW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),c=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=fW(o);return h(o)||fW(o)?u?new o(a.from,a.to,r,t.easing,c):a.to?new pW(a.from,a.to,r,t.easing):void 0:new uW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:c})})).filter((t=>!h(t)));1===e.length?t.play(e[0]):t.play(new LC(r,e))}}}function yW(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(_W(i,t[i]))})),e}function _W(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return N(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,c,d,u;if(h(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:kV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:EV,loop:null!==(n=l.loop)&&void 0!==n?n:TV,controlOptions:L({},RV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:MV,delay:null!==(a=l.delay)&&void 0!==a?a:CV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:PV,customParameters:l.customParameters,options:l.options}]}]}}const p=N(t.timeSlices).filter((t=>t.effects&&N(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:kV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:EV,loop:null!==(d=t.loop)&&void 0!==d?d:TV,controlOptions:L({},RV,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:CV,effects:N(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:PV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function vW(t,e,i){return l(t)?t.call(null,e.getDatum(),e,i):t}class bW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!h(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class xW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=yW(null!=e?e:{})}updateConfig(t){this.configs=yW(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==JN.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new bW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=_W(AV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new bW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return h(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=N(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===JN.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(h(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},o),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new mW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===JN.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(lV.ANIMATION_START,d),this.mark.emit(lV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=ON(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=vW(t.startTime,e,s),o=vW(t.totalTime,e,s),l=vW(t.oneByOne,e,s),h=vW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=vW(t.delay,e,s),l=null!==(i=vW(t.duration,e,s))&&void 0!==i?i:o/n,h=N(t.effects).map((t=>Object.assign({},t,{customParameters:vW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=v(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:v(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===JN.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===JN.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===AV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===JN.exit&&0===a[JN.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(lV.ANIMATION_END,h),this.mark.emit(lV.ELEMENT_ANIMATION_END,h,i)}}const SW=(t,e)=>zN(t)?t.output():t&&d(t)?l(t.callback)?i=>t.callback(i,e):l(t.value)?t.value(e):t:t,wW=(t,e)=>t?d(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=SW(s,e),i}),{}):t.map((t=>SW(t,e))):t;var AW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let kW=-1;class MW extends r{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++kW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=N(this.spec.dependency).map((t=>f(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=N(t).map((t=>f(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((i=>{var n;h(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return h(this.spec[e])||this.detach(DN(this.spec[e],this.view)),this.spec[e]=t,this.attach(DN(t,this.view)),this.commit(),this}}const CW=(t,e,i)=>{var n,s;if("callback"===t&&l(e))return{references:[],value:{callback:e,dependency:[]}};if(!h(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!h(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!h(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=DN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},TW=(t,e)=>{const i=(n=t.type,kN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(IN(a,e))));const o=((t,e,i)=>{if(h(e))return{value:e};if(m(e)){const n=e.map((e=>CW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return CW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},EW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=TW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class PW extends NV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if(l(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return gV(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[_V]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?dV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(lV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=o(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(lV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===JN.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==JN.enter&&this.diffState!==JN.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!h(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===JN.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=dV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{E(this.items[0].nextAttrs,e)||E(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=cV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{E(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===QN.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return vV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&E(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),E(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),E(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)gl(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[_V]=null})),this.glyphGraphicItems=null),super.release()}}const RW=t=>t.markType===QN.glyph?new PW(t):new NV(t);function BW(t){return h(t.offsetX)?h(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function IW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return b(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),b(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&b(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&b(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const DW="window",LW="view",OW={trap:!1},FW="default",zW="width",HW="height",jW="viewWidth",NW="viewHeight",VW="padding",WW="viewBox",UW="autoFit";function GW(t,e,i,n,s){if(s===DW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{IW(t,BW(t),!1)}))}));const e=BW(t);IW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var YW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class XW extends MW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new xW(this,{}),this.differ=new hW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=f(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=f(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!h(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===JN.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===oV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:SV,e);let n=i;i.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(lV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(lV.AFTER_MARK_JOIN),this.emit(lV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(lV.AFTER_MARK_STATE),this.emit(lV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(lV.AFTER_MARK_ENCODE)}return this.emit(lV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(lV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>h(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return YW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,h(t)||(f(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return f(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];LN(i)?this.detach(WN(i,this.view)):f(e)?this.detach(WN(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(WN(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return f(e)?(this.spec.encode[t][e]=i,this.attach(WN(i,this.view))):LN(e)?(this.spec.encode[t]=e,this.attach(WN(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(WN(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=EW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=EW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{h(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{h(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return vV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!h(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===JN.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];LN(s)||Object.keys(s).forEach((t=>{NN(s[t])&&(e[t]=FN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[_V];if((null==n?void 0:n.mark)===this){const i=GW(this.view,t,n,e,LW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new xW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=FN(this.spec.group,e);this.group=t,t&&(this.emit(lV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(lV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==QN.group){if(!this.graphicItem){const t=zV(this,QN.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||bV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==QN.group?(h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=HN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>xV),a=HN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>xV),o=this.spec.sort,l=this.spec.groupSort,c=this.isCollectionMark(),d=new Set(this.elements.filter((t=>t.diffState===JN.enter))),u=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(h(e))s=this.elementMap.get(n),s&&(s.diffState=JN.exit);else if(h(i)){s=this.elementMap.has(n)?this.elementMap.get(n):RW(this),s.diffState===JN.exit&&(s.diffState=JN.enter,this.animate.getElementAnimators(s,JN.exit).forEach((t=>t.stop("start")))),s.diffState=JN.enter;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),u.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=JN.update;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),u.push(s)}d.delete(s)}));const p=null!=t?t:SV;this.differ.setCurrentData(lW(p,c?a:t=>`${a(t)}-${r(t)}`,c?l:void 0)),this.differ.doDiff(),d.forEach((t=>{this.elementMap.delete(c?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=u,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(lV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(lV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:zV(this,this.markType,t);if(this.emit(lV.BEFORE_ADD_VRENDER_MARK),this.markType===QN.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(lV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==QN.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=lW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=HN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>xV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=RW(this);e.diffState=JN.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=RW(this);i.diffState=JN.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(LN(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===QN.glyph&&YN(i)){const t=YN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>pV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{pV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(lV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(lV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(pV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(lV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(lV.AFTER_MARK_JOIN),this.emit(lV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(lV.AFTER_MARK_STATE),this.emit(lV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(lV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(lV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(lV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||wV).forEach((t=>{const e=zV(this,QN.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(lV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(lV.AFTER_MARK_STATE),this.emit(lV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(lV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==JN.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return cV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=JN.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&jV(this.graphicItem),this.detachAll(),super.release()}}class $W extends XW{constructor(t,e,i){super(t,QN.component,i),this._componentDatum={[xV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:IV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,xV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[xV]+=1}evaluateJoin(t){return this.spec.key=xV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=f(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=f(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const KW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class qW extends QT{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){p(this.attribute[t])?L(this.attribute[t],e):this.attribute[t]=e,KW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>KW.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){h(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ct(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ct(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===pj.env?(pj.addEventListener("pointermove",this._onSliderPointerMove),pj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===pj.env?(pj.removeEventListener("pointermove",this._onSliderPointerMove),pj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=dt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:We(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=We(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new UM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function JW(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&JW(t,e)}))}ZW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const QW=t=>!h(t)&&!1!==t.visible,tU=["#ffffff","#000000"];function eU(t,e,i,n,s){const r=rU(t),a=rU(e);return iU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...tU);for(const s of r)if(t!==s&&iU(s,e,i,n))return s}(r,a,i,n,s)}function iU(t,e,i,n){return n?nU(t,e)>n:"largeText"===i?nU(t,e)>3:nU(t,e)>4.5}function nU(t,e){const i=sU(t),n=sU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function sU(t){const e=ae(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rU(t){if(null==t?void 0:t.includes("#"))return t;const e=new se(t),{r:i,g:n,b:s}=e.color;return"#"+oe(i,n,s)}function aU(t,e){return[t[0]*e,t[1]*e]}function oU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const lU=-.5*Math.PI,hU=1.5*Math.PI,cU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var dU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(dU||(dU={}));const uU={[dU.selectedReverse]:{},[dU.selected]:{},[dU.hover]:{},[dU.hoverReverse]:{}},pU=(t,e,i)=>new ze(Object.assign({defaultFontParams:{fontFamily:cU,fontSize:11},getTextBounds:i?void 0:yB,specialCharSet:"-/: .,@%'\"~"+ze.ALPHABET_CHAR_SET+ze.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gU(t,e){var i,n;if(!t)return{width:0,height:0};const s=yB({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var fU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sl&&(y=l,k.setAttribute("maxLineWidth",l-g[1]-g[2])));let D=0,L=0;"center"===B?(D-=y/2,m&&m.setAttribute("x",(m.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===B||"end"===B?(D-=y,m&&m.setAttribute("x",(m.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==B&&"start"!==B||f.setAttribute("x",g[3]),"middle"===I?(L-=_/2,m&&m.setAttribute("y",0)):"bottom"===I?(L-=_,m&&m.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===I&&(f.setAttribute("y",g[0]),m&&m.setAttribute("y",E/2));const{visible:O}=s,F=fU(s,["visible"]);if(u&&o(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:O&&!!e,x:D,y:L,width:y,height:_}),"rect");M(null==p?void 0:p.panel)||(t.states=p.panel)}}}mU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};class yU extends qW{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class _U extends yU{constructor(t){super(L({},_U.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}_U.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class vU extends yU{constructor(t){super(L({},vU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}vU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class bU extends yU{constructor(t){super(L({},bU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}bU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class xU extends yU{constructor(t){super(L({},xU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=lU,endAngle:n=hU}=this.attribute,s=n-i,r=Gt(Kt(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}xU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class SU extends yU{constructor(t){super(L({},SU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=$t(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}SU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const wU=new Uint32Array(33),AU=new Uint32Array(33);AU[0]=0,wU[0]=~AU[0];for(let t=1;t<=32;++t)AU[t]=AU[t-1]<<1|1,wU[t]=~AU[t];function kU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&wU[31&n]&AU[1+(31&s)])return!0}else{if(i[r]&wU[31&n])return!0;if(i[a]&AU[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,wU[31&i]&AU[1+(31&s)]);else for(n(r,wU[31&i]),n(a,AU[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,AU[31&i]|wU[1+(31&n)]);else for(s(r,AU[31&i]),s(a,wU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function MU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function CU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=MU(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function TU(t,e){return!(!t||!e)&&e.encloses(t)}function EU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return EU(t,e,s,h,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return EU(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}if("moveX"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return EU(t,e,s,r,null===(c=n.overlap)||void 0===c?void 0:c.clampForce)}return!1}const RU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],BU=["top","inside-top","inside"];const IU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function DU(t,e){var i,n;return null!==(n=null===(i=IU[e])||void 0===i?void 0:i.call(IU,t))&&void 0!==n?n:{from:{},to:{}}}const LU="same-time",OU=300,FU="linear";class zU extends qW{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||M(e.states)||(e.addState(dU.hover,!0),JW(this,(t=>{t===e||M(t.states)||t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(JW(this,(t=>{M(t.states)||(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void JW(this,(t=>{M(t.states)||(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));M(e.states)||(e.addState(dU.selected,!0),JW(this,(t=>{t===e||M(t.states)||t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!M(e)&&(t.states=e)}_createLabelText(t){const e=cB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if(l(s)&&(s=s({})),!s||0===s.length)return[];let r=[];l(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],h=this.getBaseMarkGroup(),c=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==h?void 0:h.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==h?void 0:h.AABBBounds.height())&&void 0!==s?s:0};if(0===c.width||0===c.height)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:p=!0,clampForce:g=!0}=e,f=this._bmpTool||kU(c.width,c.height),m=this._bitmap||f.bitmap(),y=u.some((t=>"bound"===t.type));d&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&m.setRange(MU(f,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:LU,h=null!==(n=a.duration)&&void 0!==n?n:OU,c=null!==(s=a.easing)&&void 0!==s?s:FU,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=DU(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&b(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new CC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(DU(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==kA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===kA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=eU(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=eU(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=eU(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class HU extends zU{constructor(t){super(L({},HU.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}HU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class jU extends zU{constructor(t){super(L({},jU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}jU.tag="rect-label",jU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const NU={rect:jU,symbol:HU};class VU extends qW{constructor(t){super(L({},VU.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!b(n*i))return;this._componentMap||(this._componentMap=new Map);const s=kU(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function WU(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function UU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=jt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function GU(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=WU(t,!!s),o=WU(r,!!s);const h=jt.distancePP(n,l),c=jt.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=UU(e,t,!1,!!s),o=UU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=WU(t,!!s),o=WU(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}VU.defaultAttributes={pickable:!1};class YU extends qW{constructor(t){super(L({},YU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!M(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let h="";if("line"===t||"polygon"===t)h=WU(o,!!n);else if("circle"===t){const{center:t}=this.attribute;h=UU(t,o,!1,!!n)}const c=oB(Object.assign({path:h,z:r},l(i)?L({},YU.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;o.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=WU(o,!!n),g=Ct(o[0].x-o[1].x),f=Ct(o[0].y-o[1].y),m=oB(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*wt/2:0,beta:gf?[o[0].x,0]:[0,o[0].y]},l(i)?L({},YU.defaultAttributes.style,i(t,e)):i));m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${s}`),this.add(m)})),e.length>1&&s)){const t=m(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0:i.size)||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};l=[...l.slice(0,l.length-1),n]}const h=aB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),M(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=dB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),M(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var $U,KU;XU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}($U||($U={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(KU||(KU={}));const qU={[KU.selectedReverse]:{},[KU.selected]:{},[KU.hover]:{},[KU.hoverReverse]:{}},ZU={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var JU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!M(e.states)&&(e.addState(dU.hover,!0),JW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(JW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(dU.selected))return this._lastSelect=null,void JW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));e.name&&!M(e.states)&&(e.addState(dU.selected,!0),JW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);L(this.attribute,t);const i=rB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=rB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,grid:r,items:a,panel:o}=this.attribute,l=rB({x:0,y:0,zIndex:1});if(l.name=$U.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=rB({x:0,y:0,pickable:!1});t.name=$U.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=lB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=$U.background,e.id=this._getNodeId("background"),M(o.state)||(e.states=L({},uU,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){var e;const i=this.getTickLineItems(),n=rB({x:0,y:0,pickable:!1});n.name=$U.tickContainer,n.id=this._getNodeId("tick-container"),t.add(n);const s=M(null===(e=this.attribute.tick)||void 0===e?void 0:e.state)?null:L({},uU,this.attribute.tick.state);i.forEach(((t,e)=>{const r=aB(Object.assign({},this._getTickLineAttribute("tick",t,e,i)));r.name=$U.tick,r.id=this._getNodeId(t.id),r.states=s,n.add(r)})),this.tickLineItems=i;const{subTick:r}=this.attribute;if(null==r?void 0:r.visible){const t=this.getSubTickLineItems();if(t.length){const e=M(r.state)?null:L({},uU,r.state);t.forEach(((t,s)=>{const r=aB(Object.assign({},this._getTickLineAttribute("subTick",t,s,i)));r.name=$U.subTick,r.id=this._getNodeId(`${s}`),r.states=e,n.add(r)}))}this.subTickLineItems=t}}renderLabels(t,e,i){var n;const{dataFilter:s}=this.attribute.label;s&&l(s)&&(e=s(e,i));const r=this._transformItems(e),a=rB({x:0,y:0,pickable:!1});a.name=`${$U.labelContainer}-layer-${i}`,a.id=this._getNodeId(`label-container-layer-${i}`),t.add(a);let o=0,h=0,c="center",d="middle";const u=M(null===(n=this.attribute.label)||void 0===n?void 0:n.state)?null:L({},uU,this.attribute.label.state);return r.forEach(((t,e)=>{var n;const s=this._getLabelAttribute(t,e,r,i),l=cB(s);l.name=$U.label,l.id=this._getNodeId(`layer${i}-label-${t.id}`),l.states=u,a.add(l);const p=null!==(n=s.angle)&&void 0!==n?n:0;o=Math.max(o,l.AABBBounds.width()),h=Math.max(h,l.AABBBounds.height()),p&&(o=Math.abs(o*Math.cos(p)),h=Math.abs(h*Math.sin(p))),c=s.textAlign,d=s.textBaseline})),this.axisLabelLayerSize[i]={width:o,height:h,textAlign:c,textBaseline:d},a}renderTitle(t){const e=this.getTitleAttribute(),i=new mU(Object.assign({},e));i.name=$U.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return rt(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&l(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;Ct(n[0])>Ct(n[1])?o=wt/2*(l.x>e.x?1:-1):h=wt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===_[1]?m+=(this.axisLabelLayerSize[n-1].height+C(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+C(this.attribute,"label.space",4))*n);const v=this.getVerticalCoord(t.point,m,p),b=this.getVerticalVector(m,p,v),x=g?g(t.label,t,e,i,n):t.label;let{style:S}=f;return S=l(S)?L({},ZU.label.style,S(t,e,i,n)):S,S=L({textAlign:this.getTextAlign(b),textBaseline:this.getTextBaseline(b,p)},S),l(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},v),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new YU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${$U.grid}-sub`:`${$U.grid}`,n.id=this._getNodeId(t),e.add(n)}}const tG={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&eG(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function eG(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function iG(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function sG(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Me(t,i),r=Me(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=ke(t),l=ke(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Ae(t.angle);let f=i?t.angle+At:Ae(90-t.angle);const m=i?e.angle:Ae(e.angle);let y=i?e.angle+At:Ae(90-e.angle);f>Mt&&(f-=Mt),y>Mt&&(y-=Mt);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Se(s,i)+Se(s,n))/2>Se(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function rG(t,e){"bottom"!==t&&"top"!==t||function(t,e){let i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var aG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return aU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:m}=l,y=aG(l,["position","space","textStyle","autoRotate","shape","background","state"]);let _=.5;"start"===c?_=0:"end"===c&&(_=1);const{verticalFactor:v=1}=this.attribute,b=-1*v,x=this.getTickCoord(_),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+C(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,T=this.getVerticalCoord(x,k,!1),E=this.getVerticalVector(k,!1);let P,R,{angle:B}=y;if(P="start"===c?"start":"end"===c?"end":"center",h(B)&&p){B=oU(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else P=this.getTextAlign(E),R=this.getTextBaseline(E,!1);const I=Object.assign(Object.assign(Object.assign({},T),y),{textStyle:Object.assign({textAlign:P,textBaseline:R},u),state:M(m)?null:{text:m.text,shape:m.shape,panel:m.background}});return I.angle=B,g&&g.visible&&(I.shape=Object.assign({visible:!0},g.style),g.space&&(I.space=g.space)),f&&f.visible&&(I.panel=Object.assign({visible:!0},f.style)),I}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=lU,endAngle:r=hU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}else{n=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(M(t))return;const{verticalLimitSize:o,label:c,title:d,line:u,tick:p,orient:g}=this.attribute,f=null!==(s=c.space)&&void 0!==s?s:4;let m=o,y=0,_=0;const v=(null==u?void 0:u.visible)?null!==(r=u.style.lineWidth)&&void 0!==r?r:1:0,x=(null==p?void 0:p.visible)?null!==(a=p.length)&&void 0!==a?a:4:0;(null==d?void 0:d.visible)&&(y=gU(d.text,d.textStyle).height,_=d.space),m&&(m=(m-f-_-y-v-x)/n);const{layoutFunc:S,autoRotate:w,autoRotateAngle:A,autoLimit:k,limitEllipsis:C,autoHide:T,autoHideMethod:E,autoHideSeparation:P}=c;l(S)?S(t,e,i,this):(w&&function(t,e){if(M(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Ut(e)})),rG(i,t),!sG(t))break}}(t,{labelRotateAngle:A,orient:g}),k&&b(m)&&m>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!M(t)&&b(i)&&t.forEach((t=>{const e=0===t.attribute.angle||h(t.attribute.angle)?"top"===s||"bottom"===s?null:i:i/Math.sin(t.attribute.angle);t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:m,ellipsis:C,orient:g}),T&&function(t,e){if(M(t))return;const i=t.filter(nG);if(M(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=l(s)?s:tG[s]||tG.parity;if(n.length>=3&&iG(n,r)){do{n=a(n,r)}while(n.length>=3&&iG(n,r));n.length<3&&!V(i).attribute.opacity&&(n.length>1&&V(n).setAttribute("opacity",0),V(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:g,method:E,separation:P}))}}oG.defaultAttributes=ZU;var lG,hG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=sB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=$U.line,c.id=this._getNodeId("line"),M(null==a?void 0:a.state)||(c.states=L({},qU,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=lU,endAngle:i=hU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=lU,endAngle:i=hU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return $t(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return aU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:m,state:y}=u,_=hG(u,["space","textStyle","shape","background","state"]);let v=l,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=C(this.attribute.label,"style.fontSize",12)+C(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;h(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",v={x:l.x,y:l.y-S}):"end"===A&&(w="top",v={x:l.x,y:l.y+S});const k=Object.assign(Object.assign(Object.assign({},v),_),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:M(y)?null:{text:y.text,shape:y.shape,panel:y.background}}),{angle:T}=_;return k.angle=T,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}cG.defaultAttributes=ZU;class dG extends oC{constructor(){super(...arguments),this.mode=CA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return JW(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},JW(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=b(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=_t.lastIndex=vt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=_t.exec(t))&&(n=vt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=vt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=lG.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=lG.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=lG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=lG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=lG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===lG.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===lG.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=lG.endHandler):this.state.start=this.state.start+o:this._activeTag===lG.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===pj.env&&(pj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),pj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===lG.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ct(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===lG.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ct(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===lG.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=pG(t,["formatMethod"]),{formatMethod:s}=e,r=pG(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:i,size:n,orient:s,middleHandlerStyle:r}=this.attribute,{width:a,height:o}=n,l=null!==(e=null===(t=null==r?void 0:r.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let h,c,d;return(null==r?void 0:r.visible)?this._isHorizontal?(h=a,c=o-l,d={x:i.x,y:i.y+l}):(h=a-l,c=o,d={x:i.x+("left"===s?l:0),y:i.y}):(h=a,c=o,d=i),this._layoutAttrFromConfig={position:d,width:h,height:c},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+P*I,y:B.y,width:(R-P)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+P*D,width:I,height:(R-P)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+P*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(P+R)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+P*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(P+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{position:i,size:n,selectedBackgroundChartStyle:s}=this.attribute,{width:r,height:a}=n,{start:o,end:l}=this.state;this.computeBasePoints(),this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?i.x+o*r:i.x,y:this._isHorizontal?i.y:i.y+o*a,width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?i.x+o*r:i.x),y:-(this._isHorizontal?i.y:i.y+o*a),width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==s?void 0:s.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==s?void 0:s.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new mU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;c(t)&&c(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...N(a))}setUpdateStateCallback(t){l(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){l(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){l(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){l(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){l(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){l(t)&&(this._statePointToData=t)}};var fG,mG,yG;gG.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!1,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(fG||(fG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(mG||(mG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(yG||(yG={}));class _G extends qW{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=rB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const vG={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:fG.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},bG={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},xG={label:{position:mG.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},SG={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},wG={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};let AG=class t extends _G{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},bG[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new XU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new mU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};AG.defaultAttributes=vG;let kG=class t extends _G{constructor(e){super(L({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},SG[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=pB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new mU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};kG.defaultAttributes=xG;let MG=class t extends _G{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=yG.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},wG[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=dB(Object.assign(Object.assign({},e),n)):"text"===i?o=new mU(Object.assign({},e)):"richText"===i?o=gB(Object.assign(Object.assign({},e),s)):"image"===i?o=uB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new XU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=aB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};MG.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const CG={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class TG extends qW{getCurrent(){return this._current}constructor(t){super(L({},TG.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new UM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new UM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(DG.item)){const t=i.delegate;t.hasState(BG.selected)?this._setLegendItemState(t,BG.selectedHover):this._setLegendItemState(t,BG.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===DG.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(IG.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(DG.item)){const t=i.delegate;t.removeState(BG.unSelectedHover),t.removeState(BG.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(BG.unSelectedHover),t.removeState(BG.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===DG.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(IG.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(DG.item)){const t=a.delegate;if(a.name===DG.focus){const e=t.hasState(BG.focus);t.toggleState(BG.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover,BG.focus]),this._setLegendItemState(t,BG.selected)})):(this._setLegendItemState(t,BG.selected),this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[BG.selected,BG.selectedHover,BG.focus]),this._setLegendItemState(e,BG.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(BG.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(BG.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(IG.legendItemClick,t);n?(this._removeLegendItemState(t,[BG.selected,BG.selectedHover]),this._setLegendItemState(t,BG.unSelected)):(this._setLegendItemState(t,BG.selected),this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover]))}else this._setLegendItemState(t,BG.selected),this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[BG.selected,BG.selectedHover]),this._setLegendItemState(e,BG.unSelected))}))}this._dispatchEvent(IG.legendItemClick,t)}}}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,BG.selected),this._removeLegendItemState(e,[BG.unSelected,BG.unSelectedHover])):(this._removeLegendItemState(e,[BG.selected,BG.selectedHover]),this._setLegendItemState(e,BG.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||M(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=rB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=EG,spaceRow:f=PG,maxWidth:m,width:y,height:_}=t;c(m)?c(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:c(y)&&(this._itemWidthByUser=y),c(_)&&(this._itemHeightByUser=_);let v=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!M(d)||(null==d?void 0:d.includes(t.label)),e),r=i.attribute.width,o=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,o),b=Math.max(r,b),this._itemMaxWidth=Math.max(r,this._itemMaxWidth),p?(w=s,c(l)&&(r>=l?(v=!0,e>0&&(x=0,S+=o+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+r):(w=n,c(h)&&h0&&i.setAttributes({x:x,y:S}),S+=f+o),a.add(i)}));let k=!1;v&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i){const{id:n,label:s,value:r,shape:a}=t,{shape:o={},label:l={},value:d={},padding:u=0,background:p,focus:g,focusIconStyle:f={}}=this.attribute.item,m=We(u);let y;!1===p.visible?(y=rB({x:0,y:0,cursor:null==p?void 0:p.style.cursor}),this._appendDataToShape(y,DG.item,t,y)):(y=rB(Object.assign({x:0,y:0},null==p?void 0:p.style)),this._appendDataToShape(y,DG.item,t,y,null==p?void 0:p.state)),y.addState(e?BG.selected:BG.unSelected);const _=rB({x:0,y:0,pickable:!1});y.add(_);let v=0;const b=C(o,"style.size",10),x=C(o,"space",8),S=dB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},a),o.style));let w;Object.keys(o.state||{}).forEach((t=>{const e=o.state[t].fill||o.state[t].stroke;a.fill&&h(o.state[t].fill)&&e&&(o.state[t].fill=e),a.stroke&&h(o.state[t].stroke)&&e&&(o.state[t].stroke=e)})),this._appendDataToShape(S,DG.itemShape,t,y,null==o?void 0:o.state),S.addState(e?BG.selected:BG.unSelected),_.add(S);let A=0;if(g){const e=C(f,"size",10);w=dB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},f),{visible:!1,pickMode:"imprecise",boundsPadding:m})),this._appendDataToShape(w,DG.focus,t,y),A=e}const k=cB(Object.assign(Object.assign({x:b/2+x,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==l?void 0:l.style.fontSize},null==l?void 0:l.style),{text:l.formatMethod?l.formatMethod(s,t,i):s}));this._appendDataToShape(k,DG.itemLabel,t,y,null==l?void 0:l.state),k.addState(e?BG.selected:BG.unSelected),_.add(k);const M=C(l,"space",8);if(v+=b/2+x+k.AABBBounds.width()+M,c(r)){const n=C(d,"space",g?8:0),s=cB(Object.assign(Object.assign({x:v+M,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==d?void 0:d.style.fontSize},null==d?void 0:d.style),{text:d.formatMethod?d.formatMethod(r,t,i):r}));this._appendDataToShape(s,DG.itemValue,t,y,null==d?void 0:d.state),s.addState(e?BG.selected:BG.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-b-x-k.AABBBounds.width()-M-A-n),d.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-b/2-m[1]-m[3]-A-n})),v=s.AABBBounds.x2+n,_.add(s)}else this._itemWidthByUser&&k.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-b-x-A);w&&(w.setAttribute("x",v),_.add(w));const T=_.AABBBounds,E=T.width(),P=T.height(),R=this._itemWidthByUser||E+m[1]+m[3],B=this._itemHeightByUser||P+m[0]+m[2];return y.attribute.width=R,y.attribute.height=B,_.translateTo(-T.x1+m[3],-T.y1+m[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=EG,spaceRow:h=PG}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=RG}=o,f=OG(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new TG(Object.assign({layout:1===r?"horizontal":"vertical",total:99},L({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new TG(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=rB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==DG.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==DG.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(BG.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=L({},FG,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new UM(t,{item:e,data:e.data,selected:e.hasState(BG.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}};var HG;function jG(t){return m(t)?t:[t,t]}function NG(t){return t?"ew-resize":"ns-resize"}zG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:EG,spaceRow:PG,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:RG,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(HG||(HG={}));let VG=class t extends qW{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(L({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===pj.env?(pj.addEventListener("pointermove",this._onHandlerPointerMove),pj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ct(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===pj.env)pj.removeEventListener("pointermove",this._onHandlerPointerMove),pj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===pj.env?(pj.addEventListener("pointermove",this._onTrackPointerMove),pj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ct(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ct(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===pj.env?(pj.removeEventListener("pointermove",this._onTrackPointerMove),pj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,d;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(c(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=N(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;h(u)&&(u=[o,l]),this._currentValue={startValue:jG(u)[0],endValue:jG(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=rB({x:0,y:0});g.name=HG.innerView,this.add(g),this._innerView=g;let f,m=0;if(r&&r.visible){f=cB(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=HG.startText,g.add(f);const e=c(r.space)?r.space:0;m+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const y=rB({x:p?m:0,y:p?0:m});g.add(y);const _=rB({x:0,y:0});let v;if(_.name=HG.railContainer,this._railContainer=_,y.add(_),this._renderRail(_),m+=p?n:s,a&&a.visible){const t=c(a.space)?a.space:0;v=cB(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),v.name=HG.endText,g.add(v)}this._renderTrack(_),d&&(this._renderHandlers(y),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=lB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=HG.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:c}=this.attribute;let{value:d}=this.attribute;h(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?l:o,[f,m]=jG(d),y=(f-i)/(n-i)*g,_=this._renderHandler(Object.assign({x:p?y:l/2,y:p?o/2:y,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":NG(p)},r));if(_.name=HG.startHandler,this._startHandler=_,t.add(_),this._currentValue.startPos=y,u){const e=this._renderHandlerText(f);e.name=HG.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(m-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":NG(p)},r));if(a.name=HG.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(m);e.name=HG.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:c}=this.attribute;h(c)&&(c=[i,n]);const u=this._isHorizontal,p=u?r:s;let[g,f]=jG(c);e||(g=i);const m=rB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=HG.trackContainer;const y=d(e)&&!0===e.draggableTrack;let _;_=!1===l?"default":!1===e||!1===y?"pointer":NG(u);const v=(f-g)/(n-i)*p,b=lB(Object.assign({x:u?(g-i)/(n-i)*p:0,y:u?0:(g-i)/(n-i)*p,width:u?v:r,height:u?s:v,cursor:_},a));b.name=HG.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return dB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":NG(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),cB(f)}_bindEvents(){const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),d(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===HG.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===HG.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===HG.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===HG.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new UM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};VG.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class WG extends LG{constructor(t){super(L({},WG.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function UG(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}WG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class GG extends LG{constructor(t){super(L({},GG.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y,sizeBackground:_}=this.attribute,v=rB({x:0,y:0});this._innerView.add(v);const b=new VG({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:UG(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=oB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}GG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};let YG=class t extends qW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,P,R,B,I,D,L,O,F,z,H,j,N,V,W,U,G,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:mt,minHeight:yt,maxHeight:_t,align:vt,verticalAlign:bt,padding:xt=0}=this.attribute,St=We(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&c(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else c(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(h=null==ct?void 0:ct.maxLineWidth)&&void 0!==h?h:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&c(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(m=ut.y)&&void 0!==m?m:At,width:null!==(_=null!==(y=ut.width)&&void 0!==y?y:pt)&&void 0!==_?_:0,height:null!==(b=null!==(v=ut.height)&&void 0!==v?v:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else c(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(c(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),c(gt)&&(Et=gt),c(ft)&&Ttmt&&(Tt=mt)),c(yt)&&Et_t&&(Et=_t)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],c(vt)||c(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:vt,e=null!==(O=null==ct?void 0:ct.width)&&void 0!==O?O:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","left")):"center"===t?(null===(H=this._mainTitle)||void 0===H||H.setAttribute("x",e/2),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(U=this._mainTitle)||void 0===U||U.setAttribute("textBaseline","top")):"middle"===t?(null===(G=this._mainTitle)||void 0===G||G.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(c(vt)||c(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:vt,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};YG.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const XG={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};let $G=class extends qW{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(c(i))if(!1!==i.visible){const t=L({},C(XG,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:c(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&b(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&b(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(c(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=N(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=L({},C(XG,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:c(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&b(a)&&this._setAutoFit(a,d,e),e.autoLimit&&b(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;h+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=gU(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",c(i.style.lineHeight)?i.style.lineHeight:s)}}};class KG extends UP{constructor(t){super(t)}}var qG,ZG;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(qG||(qG={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(ZG||(ZG={}));class JG extends qW{constructor(t){super(L({},JG.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},JG.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},JG.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},JG.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},JG.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{h(this._playController)&&(this._playController=new KG(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{h(this._backwardController)&&(this._backwardController=new KG(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{h(this._forwardController)&&(this._forwardController=new KG(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()}))},this._createCustomEvent=t=>{var e;const i=new UM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{const t=this._createCustomEvent(qG.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(qG.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(qG.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(qG.OnBackward);this.dispatchEvent(t)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}JG.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},JG.defaultAttributes={visible:!0,[ZG.Start]:{},[ZG.Pause]:{},[ZG.Backward]:{},[ZG.Forward]:{}};const QG={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},tY=[200,10];var eY,iY;!function(t){t.Default="default",t.Reverse="reverse"}(eY||(eY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(iY||(iY={}));const nY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===eY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===eY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},sY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===eY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===eY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},rY=t=>"top"===t||"bottom"===t;class aY extends qW{constructor(t){super(L({},aY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;b(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Pt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:b(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(rY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:tY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:tY[1];s.layout="vertical",s.railWidth=e,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new VG(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return rY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new JG(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=rY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:tY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=v(i)?i:Pt(i[0],i[1]);return t+e.space+n}),0),l=(rY(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:rY(this._orient)?t+n:(this._size.width-r)/2,y:rY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:rY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:rY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:rY(this._orient)?t+n:(this._size.width-r)/2,y:rY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){var i;const n=new UM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}aY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},QG),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},QG),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},QG),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},QG),{key:"backward",position:"start"})}};class oY extends aY{constructor(t){super(L({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:eY.Default,this._dataIndex=h(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(qG.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(qG.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(qG.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(qG.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(iY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(nY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||sY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===eY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(iY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(iY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(iY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),pj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(iY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,pj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(iY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(iY.OnChange),this.dispatchCustomEvent(iY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(iY.OnChange),this.dispatchCustomEvent(iY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var lY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class hY extends aY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(qG.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(qG.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(qG.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(qG.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,n=i/this._maxIndex;this._elapsed=n*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)}))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(iY.OnChange))},this.play=()=>lY(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(iY.OnPlay),this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,pj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(iY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,pj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(iY.OnPause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(iY.OnBackward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(iY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const cY={debounce:gt,throttle:ft};let dY=class t extends qW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",cY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(De(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=pB(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return L(t,...i,{shape:s.every(h)?void 0:L({},...s),key:r.every(h)?void 0:L({},...r),value:a.every(h)?void 0:L({},...a)})},pY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},gY={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:cU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Wt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},fY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let mY=class t extends qW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=We(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",L({symbolType:"circle"},d.shape,{visible:QW(d)&&QW(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:QW(d)&&QW(d.value)},pY(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:QW(d)&&QW(d.value)},d.value),"text");const u=QW(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-h[3]-h[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const m=QW(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+m);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!QW(l))return;const h=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let u=0;if(QW(l.shape)&&d.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),QW(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},pY(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(QW(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},pY(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";c(l.value.textAlign)?e=l.value.textAlign:QW(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>fY.includes(t)))?(this._mergeAttributes(e,n),h(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&QW(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=QW(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=pU(u),v=pU(p);let b=0;if(QW(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(QW(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&VP[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return uY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return uY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};mY.defaultAttributes=gY;const yY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class _Y extends $W{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=f(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}DV(iV.lineAxis,((t,e)=>new oG(t,e))),DV(iV.circleAxis,(t=>new cG(t)));class vY extends _Y{constructor(t,e,i){super(t,tV.axis,e),this.spec.componentType=tV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=L({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=IV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=fV(s,e,i,n);const c=ON(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=ON(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=ON(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case iV.lineAxis:return((t,e,i)=>{var n,s;const r=yY.axis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p);case iV.circleAxis:return((t,e,i)=>{var n,s;const r=yY.circleAxis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(h(e)){const i=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?iV.circleAxis:iV.lineAxis,this._axisComponentType}}DV(nV.discreteLegend,(t=>new zG(t))),DV(nV.colorLegend,(t=>new WG(t))),DV(nV.sizeLegend,(t=>new GG(t)));class bY extends _Y{constructor(t,e){super(t,tV.legend,e),this.spec.componentType=tV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==nV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":IG.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=f(t)?this.view.getDataById(t):t,l=f(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,eV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=IV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=fV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case nV.discreteLegend:return((t,e)=>{const i=yY.discreteLegend;return t?L({},i,{items:Array.from(new Set(N(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=jN(n),r=s?Object.assign(Object.assign({},yY.discreteLegend.items[0].shape),{fill:s,stroke:s}):yY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):L({},i,null!=e?e:{})})(o,a);case nV.colorLegend:return((t,e)=>{const i=yY.colorLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{colors:t.range().slice(),min:n[0],max:V(n)},null!=e?e:{})})(o,a);case nV.sizeLegend:return((t,e)=>{const i=yY.sizeLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&Fl(i)){const t=e.getScale().range();jN(null==t?void 0:t[0])?this._legendComponentType=nV.colorLegend:this._legendComponentType=nV.sizeLegend}else this._legendComponentType=nV.discreteLegend}return this._legendComponentType}}DV(sV.lineCrosshair,(t=>new _U(t))),DV(sV.rectCrosshair,(t=>new vU(t))),DV(sV.sectorCrosshair,(t=>new xU(t))),DV(sV.circleCrosshair,(t=>new bU(t))),DV(sV.polygonCrosshair,(t=>new SU(t)));const xY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(Hl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Yt(Kt(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else Fl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Kt(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class SY extends _Y{constructor(t,e){super(t,tV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case sV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=yY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return L({},l,xY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case sV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=yY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=xY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=L({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case sV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=yY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(Hl(e.type)){const i=Yt(Kt(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else Fl(e.type)&&(f=Kt(u,t));return L({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case sV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=yY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(Hl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else Fl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return L({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case sV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=yY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(Hl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else Fl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return L({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=tV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=IV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=fV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?sV.sectorCrosshair:sV.rectCrosshair:"radius"===n?sV.circleCrosshair:"radius-polygon"===n?sV.polygonCrosshair:sV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}DV(tV.slider,(t=>new VG(t)));class wY extends $W{constructor(t,e){super(t,tV.slider,e),this.spec.componentType=tV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=f(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=f(t)?this.view.getDataById(t):t,a=f(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,eV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>L({},yY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(h(this.spec.min)?0:ON(this.spec.min,i,t,e),h(this.spec.max)?1:ON(this.spec.max,i,t,e),fV(n,t,e,i))}),e}),{});this._encoders=e}}DV(tV.label,(t=>new VU(t)));let AY=class extends $W{constructor(t,e){super(t,tV.label,e),this.spec.componentType=tV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=ON(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=yY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case QN.line:r=yY.lineLabel;break;case QN.rect:r=yY.rectLabel;break;case QN.symbol:r=yY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[_V],n=fV(i,e.getDatum(),e,s),o=L({},r.data[0],n);a.push(o)}}));const o=ON(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return L({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!h(t)));return L({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};DV(tV.datazoom,(t=>new gG(t)));class kY extends $W{constructor(t,e){super(t,tV.datazoom,e),this.spec.componentType=tV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!h(this.spec.preview)){const t=this.spec.preview.data,e=f(t)?this.view.getDataById(t):t;this.detach(e),this.detach(WN(this.spec.preview.x,this.view)),this.detach(WN(this.spec.preview.y,this.view)),this.detach(WN(this.spec.preview.x1,this.view)),this.detach(WN(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=f(t)?this.view.getDataById(t):t;this.attach(r),this.attach(WN(e,this.view)),this.attach(WN(i,this.view)),this.attach(WN(n,this.view)),this.attach(WN(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t,c=f(e)?(t,i)=>{if(h(i.start)||h(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,eV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},yY.datazoom,t),n=IV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=f(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=fV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=yY.datazoom;return t?L({},l,{previewData:t,previewXCallback:e?t=>fV({x:e},t,r,a).x:null,previewYCallback:i?t=>fV({y:i},t,r,a).y:null,previewX1Callback:n?t=>fV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>fV({y1:s},t,r,a).y1:null},null!=o?o:{}):L({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=f(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}DV(aV.continuousPlayer,(t=>new hY(t))),DV(aV.discretePlayer,(t=>new oY(t)));let MY=class extends $W{constructor(t,e){super(t,tV.player,e),this.spec.componentType=tV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=m(t)?null:f(t)?this.view.getDataById(t):t;this.detach(e)}const r=m(e)?null:f(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=f(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(iY.OnChange,this._filterCallback),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t;return this._filterData(o,l,eV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(iY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=L({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:IV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=fV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=m(o)?null:f(o)?this.view.getDataById(o):o,h=m(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>L({},yY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>L({},yY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};DV(tV.tooltip,(t=>new mY(t)));let CY=class extends $W{constructor(t,e){super(t,tV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ft(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Wt).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>L({},yY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=tV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!h(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=fV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return N(t).reduce(((t,e)=>(t=t.concat(DN(e.visible,this.view)),VN(e.key)||(t=t.concat(DN(e.key,this.view))),VN(e.value)||(t=t.concat(DN(e.value,this.view))),VN(e.symbol)||(t=t.concat(DN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=ON(t.visible,n,e,i);return o=!!h(o)||!!o,s=VN(t.key)?ol(t.key.field)(e):ON(t.key,n,e,i),s=h(s)?void 0:u(s)?s:{text:s},r=VN(t.value)?ol(t.value.field)(e):ON(t.value,n,e,i),r=h(r)?void 0:u(r)?r:{text:r},a=VN(t.symbol)?ol(t.symbol.field)(e):ON(t.symbol,n,e,i),a=h(a)?void 0:u(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?N(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var TY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class EY extends MW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],h(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=DN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];N(t.source).forEach((t=>{const i=zN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return TY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return h(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return h(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=N(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=EW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=EW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(N(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=N(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function PY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function RY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,PY(t,e,s,n)}class BY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return PY(this.nodes,e,0,this.compare),RY(this.nodes,e,null,this.compare)}return this.nodes.push(t),PY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),PY(this.nodes,e,0,this.compare),RY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,RY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class IY{constructor(t){this.list=[],this.ids={},this.idFunc=t||ll}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var DY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class LY{constructor(){this.grammars=[],this.logger=Ve.getInstance(),this._curRank=0,this._committed=new IY((t=>t.uid)),this._heap=new BY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return DY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>h(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new IY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return DY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const OY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===QN.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class FY{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(lV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return PT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Wk.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(lV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Mj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(lV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(lV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(lV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new ZM(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=d(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new tC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class zY extends MW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?ON(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(m(t)&&m(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function $Y(t,e,i){ON(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=ON(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),h(null==n?void 0:n.clamp)||(l(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function KY(t,e,i){GY(t,e,i),YY(t,e,i),XY(t,e,i),$Y(t,e,i)}function qY(t,e,i){t.round&&e.round(ON(t.round,i,e),!0),t.padding&&e.padding(ON(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(ON(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(ON(t.paddingOuter,i,e),!0),t.align&&e.align(ON(t.align,i,e),!0)}function ZY(t,e,i,n){const s=t.field,r=FN(t.data,i),a=f(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),Fl(e.type)?(n&&a.filter((t=>v(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function JY(t,e,i){if(jY(t.domain)?e.domain(ZY(t.domain,e,i,!0),!0):e.domain(ON(t.domain,i,e),!0),jY(t.range))e.range(ZY(t.range,e,i),!0);else if(NY(t.range)){const n=FN(t.range.coordinate,i);!function(t){switch(t){case Ol.Quantile:case Ol.Quantize:case Ol.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(ON(t.range,i,e),!0);switch(t.type){case"linear":KY(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){qY(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){KY(t,e,i);const n=ON(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){GY(t,e,i),XY(t,e,i),$Y(t,e,i);const n=ON(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){KY(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){KY(t,e,i);const n=ON(t.constant,i,e);b(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){GY(t,e,i),XY(t,e,i),$Y(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){GY(t,e,i),YY(t,e,i),XY(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class QY extends MW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=HY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=HY(this.spec.type)),JY(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return h(this.spec.domain)||this.detach(WY(this.spec.domain,this.view)),this.spec.domain=t,this.attach(WY(t,this.view)),this.commit(),this}range(t){return h(this.spec.range)||this.detach(WY(this.spec.range,this.view)),this.spec.range=t,this.attach(WY(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!h(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!h(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return h(e)?null:this.parameters()[e]}configure(t){return this.detach(UY(this.spec.type,t,this.view)),h(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(UY(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let tX=-1;const eX=[zW,HW,VW,jW,NW,WW,UW],iX=t=>{var e,i,n,s;return v(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},nX=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:PV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:CV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:MV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:EV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},sX=(t,e)=>(null==e?void 0:e.debounce)?gt(t,e.debounce):(null==e?void 0:e.throttle)?ft(t,e.throttle):t,rX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:LW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):FV[t]?(i.markType=t,i.source=e):i.source=t===DW?DW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},aX={},oX=()=>aX;let lX=class extends XW{constructor(t,e){super(t,QN.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return cV.rect}evaluateJoin(t){return super.evaluateJoin(SV)}};function hX(t,e){if(b(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return b(t)?t*e:0}return 0}function cX(t,e){return Math.min(t<0?t+e:t-1,e)}function dX(t,e,i){let n=cX(t,i),s=cX(e,i);if(b(t)||b(e)?b(t)?b(e)||(n=cX(Math.max(0,s-1),i)):s=cX(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const uX=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>hX(t,i))),u=l.map((t=>hX(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=dX(e,i,r),{start:h,end:c}=dX(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},pX=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=fl(r.maxChildWidth,s.width()),o=fl(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=iX(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==QN.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(l(r))r.call(null,t,s,a,e);else if(l(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=pX(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(jW,o),i.updateSignal(NW,l),i.updateSignal(VW,h)}else pX(t,s,a,e);else"grid"===r.display&&uX(t,s,a);gX(s,e,i)}))};class fX extends XW{constructor(t,e,i){super(t,QN.glyph,i),this.glyphType=e,this.glyphMeta=YN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=HV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let mX=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return h(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return h(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return m(t)?(i.x=t[0],i.y=t[1]):v(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new qt,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class yX extends mX{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=h(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=h(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=m(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class _X extends mX{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Yt(s);const r=rt(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function vX(t){switch(t){case"cartesian":default:return new yX;case"polar":return new _X}}class bX extends MW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=vX(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=vX(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,c;!h(t.start)&&e.start(null!==(n=ON(t.start,i))&&void 0!==n?n:[0,0]),!h(t.end)&&e.end(null!==(s=ON(t.end,i))&&void 0!==s?s:[0,0]),!h(t.origin)&&e.origin(null!==(r=ON(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!h(t.translate)){const e=ON(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!h(t.rotate)){const e=ON(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!h(t.scale)){const e=ON(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}h(t.transpose)||ON(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const xX=Symbol.for("key");class SX{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new hW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i[0]}):h(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(lW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==QN.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==QN.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=lW(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=lW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!h(e.morphElementKey)){const i=HN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new hW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i}):h(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(lW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:xX})),r=lW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:xX}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==xX){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=ON(i.animation.delay,s,o,l),d=ON(i.animation.duration,s,o,l),u=ON(i.animation.oneByOne,s,o,l),p=ON(i.animation.splitPath,s,o,l),g=b(u)&&u>0?t=>v(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?bT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xT)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);mT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?bT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>uT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>gT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:kA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new fT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:gC,null!==(l=i.easing)&&void 0!==l?l:fC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:kA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new yT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:gC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:fC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):mT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class wX{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=f(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),h(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),h(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),h(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),h(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class AX{constructor(t){this.view=t}stop(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.stop()})),this}pause(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.pause()})),this}resume(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.resume()})),this}enable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.enable()})),this}disable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.disable()})),this}enableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.enableAnimationState(t)})),this}disableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.disableAnimationState(t)})),this}animate(){return this.view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){}}class kX extends XW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=LN(e)?null:Object.keys(e).reduce(((t,n)=>(NN(e[n])&&(t[n]=FN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=fV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===Ol.Band){if(!h(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===Ol.Band){if(!h(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:cV.rect}addGraphicItem(t,e){const i=zV(this,this.coord&&"polar"===this.coord.output().type?QN.arc:QN.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class MX extends XW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=LN(e)?null:Object.keys(e).reduce(((t,n)=>(NN(e[n])&&(t[n]=FN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=fV(e,t,i,s);if(h(r.size)){const t=n.x?mV(n.x):void 0,e=n.y?mV(n.y):void 0;h(t)&&h(e)?r.size=10:h(t)?r.size=e:h(e)&&(r.size=t),r.size=[t,e]}return h(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(v(i.padding)&&i.padding>0)t.size=m(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(m(i.padding)&&2===i.padding.length){const e=m(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(cV.symbol)}release(){super.release(),this._encoders=null}}var CX=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class TX extends r{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[_V],s=GW(0,t,n,e,LW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){f(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new zY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new EY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new QY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new bX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=f(e)?this.getMarkById(e):e;let s;switch(t){case QN.group:s=new lX(this,n);break;case QN.glyph:s=new fX(this,null==i?void 0:i.glyphType,n);break;case QN.component:s=((t,e,i,n)=>{switch(e){case tV.axis:return new vY(t,i,n);case tV.legend:return new bY(t,i);case tV.crosshair:return new SY(t,i);case tV.slider:return new wY(t,i);case tV.label:return new AY(t,i);case tV.datazoom:return new kY(t,i);case tV.player:return new MY(t,i);case tV.tooltip:return new CY(t,i)}return new $W(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case QN.interval:s=new kX(this,t,n);break;case QN.cell:s=new MX(this,t,n);break;default:s=new XW(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(QN.group,t)}glyph(t,e){return this.mark(QN.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(QN.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(QN.component,t,{componentType:tV.axis,mode:e})}legend(t){return this.mark(QN.component,t,{componentType:tV.legend})}crosshair(t){return this.mark(QN.component,t,{componentType:tV.crosshair})}slider(t){return this.mark(QN.component,t,{componentType:tV.slider})}label(t){return this.mark(QN.component,t,{componentType:tV.label})}datazoom(t){return this.mark(QN.component,t,{componentType:tV.datazoom})}player(t){return this.mark(QN.component,t,{componentType:tV.player})}tooltip(t){return this.mark(QN.component,t,{componentType:tV.tooltip})}customized(t,e){const i=(t=>aX[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=f(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&eX.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(lV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++tX;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(zW,t.width),this.updateSignal(HW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=oX();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(lV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=oV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:zW,value:null!==(i=t[zW])&&void 0!==i?i:0},{id:HW,value:null!==(n=t[HW])&&void 0!==n?n:0},{id:VW,value:iX(null!==(s=t[VW])&&void 0!==s?s:e[VW])},{id:jW,update:{callback:(t,e)=>{const i=iX(e[VW]);return e[zW]-i.left-i.right},dependency:[zW,VW]}},{id:NW,update:{callback:(t,e)=>{const i=iX(e[VW]);return e[HW]-i.top-i.bottom},dependency:[HW,VW]}},{id:WW,update:{callback:(t,e)=>{const i=iX(e[VW]);return(t||new Vt).setValue(i.left,i.top,i.left+e[jW],i.top+e[NW])},dependency:[jW,NW,VW]}},{id:UW,value:null!==(r=t[UW])&&void 0!==r?r:e[UW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===QN.glyph?{glyphType:t.glyphType}:t.type===QN.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(zW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(HW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(jW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(NW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(VW);if(arguments.length){const i=iX(t);return this.updateSignal(e,i),i}return iX(e.output())}autoFit(t){const e=this.getSignalById(UW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(WW);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=oV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===QN.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||gX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(lV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(lV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(lV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{OY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(lV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(lV.BEFORE_MARK_RENDER_END),OY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(lV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return CX(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return CX(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(lV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(lV.AFTER_DO_RENDER)}evaluate(t){var e,i;return CX(this,void 0,void 0,(function*(){const n=nX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=oV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=oV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=oV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=nX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=oV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=oV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=oV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!eX.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return OY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=tn(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return CX(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(zW,t)),e!==this.height()&&(n=!0,this.updateSignal(HW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,c=rX(e);if(!c)return;const{source:u,type:p}=c,g=h((v=c).markId)?t=>t&&t.mark.id()===v.markId:h(v.markName)?t=>t&&t.mark.name()===v.markName:h(v.type)?t=>t&&t.mark.markType===v.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:f(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),y=IN(l,this),_=sX(((t,e)=>{const n=u===LW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===DW&&(t=GW(0,t,e,p,DW));let s=!1;if((!i||i(t))&&(!g||g(e))&&m.length){const e=y.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var v;if(u===LW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||d(n)&&!n[i])}(this._eventConfig,LW,p))return this.addEventListener(p,_,OW),()=>{this.removeEventListener(p,_)}}else if(u===DW)return pj.addEventListener(p,_),this._eventListeners.push({type:p,source:pj,handler:_}),()=>{pj.removeEventListener(p,_);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===pj&&t.handler===_));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);f(e)?i.type=e:d(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:FW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?f(r)?r:r.user:FW,o=r&&a===r.user&&(s===r.element||h(s)&&h(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==FW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!h(document)&&document.body:this.container;return e?h(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new FY(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new wX((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new wX((t=>t.id())),this._options.logger&&Ve.setInstance(this._options.logger),this.logger=Ve.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new LY,this.animate=new AX(this),this._morph=new SX,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{m(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[LW,DW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&pj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=oV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==QN.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=pj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&pj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),TN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const EX=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{CN(e,t[e],!0)}))}))};EX(yV);const PX=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var RX,BX,IX;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(RX||(RX={})),function(t){t.chart="chart",t.window="window"}(BX||(BX={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(IX||(IX={}));const DX=`${$j}_waterfall_default_seriesField`,LX=`${$j}_DEFAULT_DATA_INDEX`,OX=`${$j}_DEFAULT_DATA_KEY`,FX=`${$j}_DEFAULT_DATA_SERIES_FIELD`,zX=`${$j}_DEFAULT_SERIES_STYLE_NAME`;var HX;!function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.Built_In=99]="Built_In"}(HX||(HX={}));const jX=`${$j}_STACK_START`,NX=`${$j}_STACK_END`,VX=`${$j}_STACK_START_PERCENT`,WX=`${$j}_STACK_END_PERCENT`,UX=`${$j}_STACK_START_OffsetSilhouette`,GX=`${$j}_STACK_END_OffsetSilhouette`,YX=`${$j}_SEGMENT_START`,XX=`${$j}_SEGMENT_END`;var $X,KX;!function(t){t[t.Axis_Grid=100]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark"}($X||($X={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(KX||(KX={}));const qX=["linear","radial","conical"],ZX={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},JX={innerRadius:0,outerRadius:1,startAngle:SN,endAngle:wN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var QX,t$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(QX||(QX={})),function(t){t.middle="middle",t.start="start",t.end="end"}(t$||(t$={}));const e$={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,tickSize:Bj,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Bj/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Pj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Pj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},i$={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},n$={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},s$={name:"light",padding:12,fontFamily:Ej,colorScheme:{default:{dataScheme:[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Pj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Pj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Gj,line:jj,area:Ij,bar:Dj,bar3d:Lj,pie:Vj,pie3d:Wj,map:Nj,radar:Uj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:Oj,funnel3d:Fj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:Yj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:Hj,treemap:Xj,sunburst:JX,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Pj},minLabel:{position:t$.end},maxLabel:{position:t$.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Pj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Pj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...n$,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...n$,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...n$},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...n$}},axis:e$,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10},maxHeight:"30%"},axisY:{label:{space:20},title:{space:20,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Pj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Pj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!1,background:{size:5,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:8,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:i$,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Rj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Pj,lineHeight:Rj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Pj,fontFamily:Ej}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Pj,fontFamily:Ej}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}}}},r$=new Map([[s$.name,s$]]),a$=s$.name;class o${static instances=new Map;static registerInstance(t){o$.instances.set(t.id,t)}static unregisterInstance(t){o$.instances.delete(t.id)}static getInstance(t){return o$.instances.get(t)}static instanceExist(t){return o$.instances.has(t)}static forEach(t,e=[],i){const n=N(e);return o$.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class l${static themes=new Map;static _currentThemeName=a$;static registerTheme(t,e){t&&l$.themes.set(t,L({},l$.getDefaultTheme(),e))}static getTheme(t){return l$.themes.get(t)||l$.getDefaultTheme()}static removeTheme(t){return l$.themes.delete(t)}static themeExist(t){return l$.themes.has(t)}static getDefaultTheme(){return l$.themes.get(a$)}static setCurrentTheme(t){l$.themeExist(t)&&(l$._currentThemeName=t,o$.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return l$.getTheme(l$._currentThemeName)}static getCurrentThemeName(){return l$._currentThemeName}}l$.registerTheme(a$,r$.get(a$)),r$.forEach(((t,e)=>{e!==a$&&l$.registerTheme(e,t)}));const h$=(t,e,i)=>new ze({defaultFontParams:{fontFamily:Tj,fontSize:14},getTextBounds:i?void 0:yB,specialCharSet:"-/: .,@%'\"~"+ze.ALPHABET_CHAR_SET+ze.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),c$=gB({});function d$(t,e){for(let i=0;it.key===e))}function p$(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const g$=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;s{M(t.state[e])||(t.state[e]=_$(t.state[e]))})),t}function y$(t){return M(t)?null:(Object.keys(t).forEach((e=>{M(t[e])||(t[e]=_$(t[e]))})),t)}function _$(t){return M(t)||t.angle&&(t.angle=Ut(t.angle)),t}var v$;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(v$||(v$={}));class b${static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Ja,fields:eo,filter:un,fold:to};static dataParser={csv:go,dsv:po,tsv:fo};static _layout={};static registerChart(t,e){b$._charts[t]=e}static registerSeries(t,e){b$._series[t]=e}static registerComponent(t,e){b$._components[t]=e}static registerMark(t,e){b$._marks[t]=e}static registerRegion(t,e){b$._regions[t]=e}static registerTransform(t,e){b$.transforms[t]=e}static registerLayout(t,e){b$._layout[t]=e}static createChart(t,e,i){if(!b$._charts[t])return null;return new(0,b$._charts[t])(e,i)}static createRegion(t,e,i){if(!b$._regions[t])return null;return new(0,b$._regions[t])(e,i)}static createSeries(t,e,i){if(!b$._series[t])return null;return new(0,b$._series[t])(e,i)}static createMark(t,e,i){if(!b$._marks[t])return null;const n=new(0,b$._marks[t])(e,i);return n.type===v$.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(b$._components)}static getComponentInKey(t){return b$._components[t]}static getLayout(t){return b$._layout[t]}static getSeries(t){return b$._series[t]}}const x$=(t,e,i)=>{const n=t.getRegionsInIds(N(e.layoutBindRegionID));return n?.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},S$=(t,e)=>t===e||!h(t)&&!h(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),w$=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},A$="monotone",k$="linearClosed";var M$;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(M$||(M$={}));var C$;function T$(t){return"bottom"===t||"top"===t}function E$(t){return"left"===t||"right"===t}function P$(t){return"z"===t}function R$(t,e){return Uh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(C$||(C$={}));const B$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&x$(t,n,i)));return n.length?n:null},I$=t=>t.fieldX[0],D$=t=>t.fieldY[0],L$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=O$(t,n,"x",I$);e&&o.push(e)})),a&&a.forEach((t=>{const e=O$(t,s,"y",D$);e&&o.push(e)})),o.length?o:null},O$=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return F$(t,a,n)},F$=(t,e,i)=>{const n=t.getScale();if(!n||!Hl(n.type))return null;if(h(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=w$(e,t,"cartesian",i??(T$(t.orient)?I$:D$));return{index:s,value:e,axis:t,data:r}},z$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&x$(t,n,i)));return n.length?n:null},H$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&Hl(e.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=Bl({x:1,y:0},d);u=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(u,r);const p=Il(d),g=a[0]?.getScale(),f=g?.range();if((u-r?.[0])*(u-r?.[1])>0||(p-f?.[0])*(p-f?.[1])>0)return;const m=Math.abs(r[0]-r[1])/i.length/2,y=e.invert(u+m);if(h(y))return;let _=e.domain().findIndex((t=>t?.toString()===y.toString()));_<0&&(_=void 0);const v=w$(y,t,"polar",l);o.push({index:_,value:y,axis:t,data:v})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&Hl(e.type)){const a=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let d=Bl({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const u=Il(c),p=r[0]?.getScale(),g=p?.range();if((d-g?.[0])*(d-g?.[1])>0||(u-i?.[0])*(u-i?.[1])>0)return;const f=e.invert(u);if(h(f))return;let m=e.domain().findIndex((t=>t?.toString()===f.toString()));m<0&&(m=void 0);const y=w$(f,t,"polar",l);o.push({index:m,value:f,axis:t,data:y})}})),o.length?o:null};class j${_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=L$(this._chart,{x:t,y:e})??[],n=H$(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!Hl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=F$(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var N$;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(N$||(N$={}));const V$={[N$.dimensionHover]:class extends j${_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:BX.chart},callback:this.onMouseMove}),Zo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:BX.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Zo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!S$(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[N$.dimensionClick]:class extends j${constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:BX.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let W$=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(V$[t]){const e=new V$[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(V$[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class U${_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(IX.vchart,[]),this._levelNodes.set(IX.chart,[]),this._levelNodes.set(IX.model,[]),this._levelNodes.set(IX.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const G$={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class Y${globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||BX.chart),n=this.getEventListeners(e.filter?.source||BX.chart);i.get(t)||i.set(t,new U$);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||BX.chart),s=this.getEventListeners(e?.filter?.source||BX.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||BX.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||BX.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(IX.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(IX.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(IX.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(IX.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(BX.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(BX.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if(l(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&C(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return G$[n]&&(n=G$[n]),(!t.type||n===t.type)&&(!c(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=c(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=c(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&c(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();c(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:C(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:c(t.id)?IX.model:IX.vchart:IX.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ft(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=gt(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=BX.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==IX.model&&i!==IX.mark||(n=e.type),e?.source&&(s=e.source),c(e?.id)&&(o=e?.id,i=IX.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case BX.chart:return this._viewBubbles;case BX.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case BX.chart:return this._viewListeners;case BX.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return PX.includes(t)||Object.values(lV).includes(t)||Object.values(RX).includes(t)}}function X$(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function $$(t,e,i){t.getParser(e)||t.registerParser(e,i)}const K$=new Map;let q$;function Z$(t,e,i={type:"geojson",centroid:!0}){K$.has(t)&&Go(`map type of '${t}' already exists, will be overwritten.`),q$||(q$=new Ho,$$(q$,"geojson",Io),$$(q$,"topojson",Lo),X$(q$,"simplify",Ja));const n=new No(q$),s=L({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),K$.set(t,n)}function J$(t,e=!1){let i=e;return t.latestData instanceof No&&(i=!1),i?R(t.latestData):t.latestData.slice()}const Q$=(t,e)=>0===t.length?[]:1===t.length?J$(t[0],e?.deep):t.map((t=>J$(t,e?.deep)));function tK(t,e,i){X$(e=e instanceof Ho?e:t.dataSet,"copyDataView",Q$);const n=new No(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function eK(t,e,i=[]){if(t instanceof No)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new No(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!f(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Yo("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const iK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)}}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!f(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&pj.getCancelAnimationFrame()(this._rafId),this._rafId=pj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===BX.chart){const n=function(n,s){const r=s?.mark?.context??{},a=c(r.modelId)?r.modelId:null,o=c(r.markId)?r.markId:null,l=c(r.modelUserId)?r.modelUserId:null,h=c(r.markUserId)?r.markUserId:null,d={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,d)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===BX.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===BX.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===BX.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(h(e))return;const i=e.id(),n=t.grammarType;h(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(h(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];c(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return c(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return qo(this._option.mode)?globalThis:this.getStage()?.window}}async function cK(t){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){console.error("getCanvasDataURL",t)}return t.toDataURL()}class dK{id=tl();static useChart(t){t.forEach((t=>b$.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>b$.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>b$.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>b$.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>b$.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){b$.registerTransform(t,e)}static registerMap(t,e,i){Z$(t,e,i)}static unregisterMap(t){!function(t){K$.has(t)?K$.delete(t):Go(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,K$.get(e);var e}static hideTooltip(t=[]){o$.forEach((t=>t?.hideTooltip?.()),t)}static InstanceManager=o$;static ThemeManager=l$;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=L(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,...a}=this._option;i&&(this._container=f(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=l$.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new hK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,...a,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new Y$(this,this._compiler),this._event=new W$(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!qo(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(RX.initialized,{}),o$.registerInstance(this)):Yo("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=Zh(f(t)?JSON.parse(t):t))}_initData(){if(h(this._dataSet))return void Go("dataSet is not initialized");const t=N(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Yo("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=gt(((...t)=>{const{width:e,height:i}=tn(this._container,Kj,qj),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof Ho?t:new Ho,$$(this._dataSet,"dataview",Oo),$$(this._dataSet,"array",hn),X$(this._dataSet,"stackSplit",iK),X$(this._dataSet,"copyDataView",Q$);for(const t in b$.transforms)X$(this._dataSet,t,b$.transforms[t]);for(const t in b$.dataParser)$$(this._dataSet,t,b$.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return c(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)}))),this._event.emit(RX.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)}))),this._event.emit(RX.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),K$.clear(),q$=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,o$.unregisterInstance(this)}async updateData(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):m(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new No(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new No(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(f(t)&&(t=JSON.parse(t)),e&&(t=L({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=Zh(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}_updateCurrentTheme(){f(this._spec?.theme)?(this._currentTheme=L({},l$.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=L({},l$.getTheme(this._currentThemeName),this._spec?.theme??{})}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return l$.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===dn.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(c(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===dn.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===dn.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===dn.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await cK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!qo(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(c(this._container))return this._container;let t;return t=f(this._canvas)?document?.getElementById(this._canvas):this._canvas,c(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(M(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),qh(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||h(t)||M(e))return null;if(!m(t)){const{axisId:n,axisIndex:s}=e;let r;if(c(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):c(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Go("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?qh(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Go("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(rK||(rK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aK||(aK={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(oK||(oK={}));class uK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){h(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,L({},uK.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return[...this._children]}getMarksInType(t){const e=N(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}class pK{event;interaction;_option;_marks=new uK;_markReverse=new uK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){M(t.stateStyle[rK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),M(t.stateStyle[rK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(N$.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=m(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(rK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(rK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(rK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(rK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(rK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class gK{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class fK extends gK{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=KX.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=$h(Kh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=h(t.minHeight)?null:Xh(t.minHeight,e.height,e),this._maxHeight=h(t.maxHeight)?null:Xh(t.maxHeight,e.height,e),this._minWidth=h(t.minWidth)?null:Xh(t.minWidth,e.width,e),this._maxWidth=h(t.maxWidth)?null:Xh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Xh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Xh(t.height,e.height,e)},{height:9}),h(t.offsetX)||(this.layoutOffsetX=Xh(t.offsetX,e.width,e)),h(t.offsetY)||(this.layoutOffsetY=Xh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{h(this._spec[i])||(e[i]=Xh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};h(n)||(r.width-=n),h(s)||(r.width-=s),h(e)||(r.height-=e),h(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(h(n)?h(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,h(e)?h(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){b(t)&&(this._layoutStartPoint.x=t),b(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){b(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),b(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}_setRectInSpec(t){const e={...t};return this._layoutRectLevelMap.width<9?(h(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),h(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(h(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),h(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class mK extends gK{grammarType;id=tl();_product;getProduct(){if(c(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return c(e)&&c(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){c(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(c(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(c);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class yK extends mK{grammarType=sK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}c(this._value)&&this._product.value(this._value),c(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class _K extends gK{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new yK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class vK extends _K{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(L(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class bK extends vK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class xK extends fK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new uK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=tl(),this._originalSpec=t,this._spec=Jh(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new W$(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new bK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Jh(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(h(t)||h(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=L({},e?.[N(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),m(t))return t.map((t=>d(t)&&!l(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];d(n)&&!l(n)&&(Oh(n)?e[i]=Lh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){c(t)&&c(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!c(t)||!c(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${$j}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=b$.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const SK={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",rectRound:"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"},wK={symbol:function(t,e){return"shape"===t?SK[e]??e:e}};const AK={};Object.values(rK).forEach((t=>{AK[t]=!0}));const kK={[rK.STATE_HOVER]:rK.STATE_HOVER_REVERSE,[rK.STATE_SELECTED]:rK.STATE_SELECTED_REVERSE,[rK.STATE_DIMENSION_HOVER]:rK.STATE_DIMENSION_HOVER_REVERSE};function MK(t){return kK[t]}class CK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!M(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=MK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=MK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=MK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=MK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class TK extends vK{id=tl();stateKeyToSignalName=t=>`${$j}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===nK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===nK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===nK.enter?nK.appear:nK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===nK.enter?nK.appear:nK.none}}}}class EK extends xK{static type="region";modelType="region";type=EK.type;_series=[];layoutType="region";layoutZIndex=$X.Region;animate;interaction=new CK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new TK({getCompiler:e.getCompiler})),c(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:v$.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",HX.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",HX.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:v$.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:v$.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",HX.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex($X.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",HX.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",HX.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",HX.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||N(t.userId).includes(e.userId))&&(!c(t.specIndex)||!e.getSpecIndex||N(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(RX.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new pK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aK)M(t.stateStyle[aK[e]])||this.interaction.registerMark(aK[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class PK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient&&(this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const RK=[v$.line,v$.area,"trail"];function BK(t){return RK.includes(t)}class IK extends vK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];c(n.domain)&&(s.domain=n.domain),c(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=o(BK)?n:!t.mark||BK(t.mark.markType);let s=!1,r=!1;if(c(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!AK[t])).map((t=>[t,10])),n=!t.mark||BK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(m(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith($j)));n=t.datums.some((t=>i&&m(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(d(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith($j)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(Fl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class DK extends mK{grammarType=sK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();h(t)||(h(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class LK extends DK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return c(t)?t:`${$j}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct(t)}}class OK extends mK{grammarType=sK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=$X.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){c(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){h(this._data)&&this.initMarkData({...this._option,mark:this}),c(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new IK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new W$(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new LK(t)}stateKeyToSignalName(t){return`${$j}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(c(e)&&this.removeProduct());if(c(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),h(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(h(this._data))return;this._data.compile();const t=this._data.getProduct();c(this._product)&&c(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[rK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!l(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(lV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===nK.appear&&this.runAnimationByState(nK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),wK[a]?wK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class FK extends OK{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(c(t.id)&&(this._userId=t.id),o(t.interactive)&&(this._interactive=t.interactive),c(t.zIndex)&&this.setZIndex(t.zIndex),o(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(v(t))return xl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(xl)),t}return"function"==typeof t?(e,i,n,s)=>xl(t(e,i,n,s)):t}isUserLevel(t){return[HX.User_Mark,HX.User_Series,HX.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];h(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;c(r)&&r<=n&&L(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(zl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return f(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=jh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;return s=this.stateStyle[i]?.[t]?this._computeStateAttribute(this.stateStyle[i][t],t,e,i,n):this._computeStateAttribute(this.stateStyle.normal[t],t,e,i,n),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,s):s}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):qX.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):zl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",HX.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=l(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,HX.User_Mark,e)}else this.setStyle(i,t,HX.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let h=s,d=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(h=t),d||(d=e)}const u=Ih(Bh(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),p={},g={...ZX[n],...a};return Object.keys(g).forEach((t=>{const n=g[t];"stops"===t?p.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??h?.scale(e[d]);return l(s)&&(a=s(e,this._attributeContext,i,o)),c(n)&&(a=Uo.SetOpacity(a,n)),{offset:l(r)?r(e,this._attributeContext,i,o):r,color:a||u[0]}})):l(n)?p[t]=n(e,this._attributeContext,i,o):p[t]=n})),p.gradient=n,p}_computeThresholdAttr(t){return(new Ch).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class zK extends FK{static type=v$.group;type=zK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Go("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Go("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class HK extends FK{static type=v$.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(QN.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}dK.useMark([HK,zK]),b$.registerRegion("region",EK),b$.registerLayout("base",PK);var jK,NK,VK;Ve.getInstance(Ne.Error),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(jK||(jK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(NK||(NK={}));class WK{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?jh("colorOrdinal"):jh(t.type)),e?(m(t.range)&&e.range(t.range),m(t.domain)&&(il(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),il(n.domain)?e.reRender=!0:z(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{il(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{d$(e,[{key:t,operations:Fl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&d$(e,[{key:i.field,operations:Fl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!il(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=Fl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{Fl(e.type)?(h(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),h(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;Fl(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!h(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(Fl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(Fl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));Fl(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(h(t.field)||!h(t.changeDomain)&&"none"!==t.changeDomain&&!h(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class UK{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(RX.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][NX]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[NX],s>=0?(t[jX]=e,e+=t[NX],t[NX]=e):(t[jX]=i,i+=t[NX],t[NX]=i)})),t.values.forEach((t=>{s=t[NX];const r=s>=0?e:i;n=s>=0?1:-1,t[VX]=Math.min(1,t[jX]/r)*n,t[WX]=Math.min(1,t[NX]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[NX]=function(t){if(b(t))return t;const e=+t;return b(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class GK extends gK{type="chart";id=tl();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:Kj,height:qj};getLayoutRect(){return this._layoutRect}_viewRect={width:Kj,height:qj};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:Kj,y2:qj};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=Kh(t.padding??this._theme?.padding),this._event=new W$(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new UK(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),E(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=b$.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=eK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),c(t.regionId)?i=this.getRegionsInUserId(t.regionId):c(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=b$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&N(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=b$.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(b$.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(RX.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(RX.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>N(t).some((t=>c(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof xK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof FK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof FK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(c(t)&&c(e))this._canvasRect={width:t,height:e};else{let i=Kj,n=qj;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=tn(this._option.container,Kj,qj);i=t,n=e}else if(r&&qo(this._option.mode)){let t;t=f(r)?document?.getElementById(r):r;const{width:e,height:s}=tn(t,Kj,qj);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;if(m(t))e.range=t.map((t=>Lh(t,this._theme?.colorScheme)));else{const i=t;Object.prototype.hasOwnProperty.call(i,"type")&&(e.type=i.type),Object.prototype.hasOwnProperty.call(i,"domain")&&(e.domain=i.domain),Object.prototype.hasOwnProperty.call(i,"range")&&(e.range=i.range),Object.prototype.hasOwnProperty.call(i,"specified")&&(e.specified=i.specified)}}return e.range?.length||(e.range=Bh(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new WK(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Bh(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&N(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};m(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=$h(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(M(t[n]))continue;const s=t[n];let r={stateValue:n};r=l(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rK.STATE_HOVER,!0,t,e,i)}initEvent(){[RX.dataZoomChange,RX.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(lV.AFTER_MARK_RENDER_END,e)};this._event.on(lV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||l(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===N$.dimensionHover||s===N$.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===dn.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===dn.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class YK extends GK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function XK(t){t.crosshair=N(t.crosshair||{}).map((e=>L({[t.direction===Wh.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(VK||(VK={}));const $K=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!h(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!h(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!h(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=c,(h(o)||o===DX)&&(t[DX]=c?l.total:+t[n]>=0?l.increase:l.decrease)})),f={...i,lastIndex:t},d.push(i)})),d},KK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},qK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:ZK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function ZK(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>ZK(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class JK{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new No(e instanceof Ho?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),X$(e,"dimensionTree",qK),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const QK=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},tq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class eq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new uK;_markReverse=new uK;constructor(t,e){this._spec=t,this._option=e,this.event=new W$(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(rK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(rK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(N(i).forEach((e=>{t.on(e,{level:IX.chart},this.onHover)})),n&&"none"!==n&&N(n).forEach((e=>{t.on(e,{level:IX.vchart,source:BX.chart},this.onUnHover)}))),s&&(N(r).forEach((e=>{t.on(e,{level:IX.mark},this.onSelect)})),a&&"none"!==a&&N(a).forEach((e=>{t.on(e,{level:IX.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=tq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;o(i)?this._hover.enable=i:d(i)&&(this._hover.enable=!0,this._hover=L(this._hover,i));const n=this._spec.select;o(n)?this._select.enable=n:d(n)&&(this._select.enable=!0,this._select=L(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,rK.STATE_HOVER)||this.interaction.getEventElement(rK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,rK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(rK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(rK.STATE_HOVER,t.item),this.interaction.reverseEventElement(rK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(rK.STATE_HOVER);this.interaction.clearEventElement(rK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(rK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,rK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(rK.STATE_SELECTED);this.interaction.clearEventElement(rK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(rK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(rK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(rK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(rK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(rK.STATE_SELECTED);const e=this.interaction.getEventElementData(rK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,rK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class iq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const nq=(t,e)=>c(e)?t.map((t=>e[t])):void 0,sq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),rq=t=>!h(t)&&(m(t)?t.length>0&&t.every(c):Object.keys(t).length>0);function aq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(c(s.regionId)?[s.regionId]:void 0,c(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=c(s)?t[s]:void 0,a=c(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=nq(i,t);let d=nq(n,t);const u=rq(d),p=!u&&c(s)&&h(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,c=i.map(((t,e)=>[t,e])).filter((([,t])=>h(l?.[t])));let g=[l??[]];c.length>0&&c.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];g.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),g=s})),g.forEach((l=>{if(p){const r=t.getViewData()?.latestData.filter(sq(i,l));a.forEach((a=>{const c=r.find((t=>t[s]===a));if(d=nq(n,c),!rq(d))return;const p=t.dataToPosition(c);h(p)||isNaN(p.x)||isNaN(p.y)||o.push({pos:p,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===NK.pie){const t=e,a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToCentralPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}else{const t=e;if(p){const c=t.getViewData()?.latestData.filter(sq(i,l)),p=c.find((t=>t[s]===r));a.forEach((r=>{if(d=nq(n,p),!rq(d))return;const a=t.dataToPosition(p);h(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),d=r.getLayoutStartPoint(),u=r.getLayoutRect(),p=n.globalInstance.getContainer(),g={x:0,y:0,...p?en(p):{}},f=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>sq(e,i)(t)&&sq(n,s)(t)&&(h(r)||sq([r],[a])(t))));return o},m=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),u.width),y:Math.min(Math.max(t.y,0),u.height)}))(t),i=s.x??d.x+e.x,n=s.y??d.y+e.y;return{canvasX:i,canvasY:n,clientX:g.x+i,clientY:g.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>f(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:BX.chart,event:m({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return dK.globalConfig.uniqueTooltip&&dK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...f(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:BX.chart,event:m(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return dK.globalConfig.uniqueTooltip&&dK.hideTooltip(a.id),l}return"none"}const oq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return c(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function lq(t){return h(t.mark)&&h(t.model)&&h(t.datum)}class hq extends iq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];c(i)&&(e[t]={...i,title:c(i.title)?l(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:c(i.content)?l(i.content)?i.content:N(i.content).map((t=>l(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=oq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:c(e)?N(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of N(e)){const e=this.series.getSeriesStyle(t)?.(i);if(c(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const cq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},dq={min:t=>t===cq.min()?0:t,max:t=>t===cq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===cq.min()?0:t,"array-max":t=>t===cq.max()?0:t};const uq={min:function(t,e){return el(e)?Math.min(t,e):t},max:function(t,e){return el(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>el(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>el(t)));return 0===i.length?t:Math.max(t,...i)}},pq=(t,e)=>{const i={};let n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;n=d$([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!h(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=cq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=uq[n](i[t.key][n],s)})),i[t.key][n]=dq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},gq=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>el(t[s])));else if("zero"===n)return t.forEach((t=>{el(t[s])||(t[s]=0)})),t;return t};class fq extends DK{_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const mq=`${$j}_HIERARCHY_DEPTH`,yq=`${$j}_HIERARCHY_ROOT`,_q=`${$j}_HIERARCHY_ROOT_INDEX`,vq=()=>({keyMap:new Map});function bq(t,e,i){t&&(this._seriesField||(t[FX]=this.getSeriesKeys()[0]),t[LX]=e,t[OX]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function xq(t,e,i,n=0,s,r){void 0===r&&(r=e),bq.bind(this)(t,e,i),t[mq]=n,t[yq]=s||t[this.getCategoryField()],t[_q]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>xq.bind(this)(e,n,i,t[mq]+1,t[yq],r)))}class Sq extends xK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[jK.label]:{name:jK.label,type:v$.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([v$.line,v$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(RX.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&c(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(RX.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(h(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),o(this._spec.stack)&&(this._stack=this._spec.stack),o(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),o(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),c(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=tK(this._rawData,this._dataSet,{name:`${$j}_series_${this.id}_viewDataFilter`});const t=tK(this._viewDataFilter,this._dataSet,{name:`${$j}_series_${this.id}_viewData`});this._data=new fq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(X$(this._option.dataSet,"invalidTravel",gq),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new JK(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${$j}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${$j}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){X$(this._dataSet,"dimensionStatistics",pq);const n=new No(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=d$(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&d$(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${$j}_series_${this.id}_viewStackData`;this._viewStackData=new No(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(h(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(f(t))return e[t];if(m(t)&&t.every((t=>f(t))))return t.map((t=>e[t])).join("-");if(l(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(X$(this._rawData.dataSet,"addVChartProperty",QK),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(RX.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(RX.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(RX.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(RX.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(RX.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||h(e)?[]:f(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:v$.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${$j}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${$j}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||h(t.dataId)&&h(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new eq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??FX;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:zX,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,zX)}))}afterInitMark(){this.event.emit(RX.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",HX.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new hq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??FX,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Bh(this._option.getTheme().colorScheme,this.type);return(new zh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??FX}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=L({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:l,dataProductId:d,parent:u,isSeriesMark:p,dataStatistics:g,depend:f,label:m,progressive:y,support3d:_=this._spec.support3d||!!this._spec.zField,morph:v=!1}=e,b=super._createMark(t,{key:i??this._getDataIdKey(),support3d:_,dataStatistics:g??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(c(b)){this._marks.addMark(b),p&&(this._seriesMark=b),h(u)?this._rootMark?.addMark(b):!1!==u&&u.addMark(b),h(l)?(b.setDataView(this.getViewData(),this.getViewDataProductId()),b.setSkipBeforeLayouted(!0)):!1!==l&&b.setDataView(l,d),o(s)&&b.setSkipBeforeLayouted(s),c(f)&&b.setDepend(...N(f)),c(m)&&b.setLabelSpec(m);const t=this.getSpec()||{};b.setMorph(v),b.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),b.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),h(y)||b.setProgressiveConfig(y),h(n)||b.setGroupKey(n),this.initMarkStyleWithSpec(b,L({},r,a||t[b.name]))}return b}_getDataIdKey(){return super._getDataIdKey()??OX}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==NX&&t!==WX&&t!==jX&&t!==VX||(t=this.getStackValueField()),p$(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=b$.getSeries(this.type);return Object.values(t.mark??{})}return t}}class wq extends Sq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=N(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=N(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&N(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=Wh.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&this._fieldX.forEach((e=>{const i={key:e,operations:[]};Fl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&this._fieldY.forEach((e=>{const i={key:e,operations:[]};Fl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};Fl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===Wh.vertical?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction===Wh.vertical?(this.setFieldY(NX),this.setFieldY2(jX)):(this.setFieldX(NX),this.setFieldX2(jX))}setValueFieldToPercent(){this.direction===Wh.vertical?(this.setFieldY(WX),this.setFieldY2(VX)):(this.setFieldX(WX),this.setFieldX2(VX))}setValueFieldToStackOffsetSilhouette(){this.direction===Wh.vertical?(this.setFieldY(GX),this.setFieldY2(UX)):(this.setFieldX(GX),this.setFieldX2(UX))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Wo(t.xField,i)&&Wo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),c(this._spec.direction)&&(this._direction=this._spec.direction),this._direction===Wh.vertical?(this.setFieldY2("y1"),this.setFieldX2(this._spec?.x2Field)):(this.setFieldX2("x1"),this.setFieldY2(this._spec?.y2Field)),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[0]:Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===Wh.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===Wh.vertical?N(this._spec.yField??this.fieldY):N(this._spec.xField??this.fieldX)}}const Aq=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};const kq={type:"clipIn"},Mq={type:"fadeIn"};function Cq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===Wh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Wh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Mq;default:return kq}}function Tq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=i?.[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const Eq=(t,e=!0)=>({type:t.direction===Wh.horizontal?"growWidthIn":"growHeightIn",options:Tq(t,e)}),Pq=(t,e=!0)=>({type:t.direction===Wh.horizontal?"growWidthOut":"growHeightOut",options:Tq(t,e)}),Rq={type:"fadeIn"},Bq={type:"growCenterIn"};function Iq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Rq;case"scaleIn":return Bq;default:return Eq(t)}}const Dq={type:"clipIn"},Lq={type:"fadeIn"};function Oq(t,e){switch(e){case"grow":return(t=>({type:t.direction===Wh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Wh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Lq;default:return Dq}}function Fq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const zq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Fq(t,!0,nK.appear)}),Hq={type:"fadeIn"},jq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Fq(t,!0,nK.enter)}),Nq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Fq(t,!0,nK.exit)}),Vq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:Fq(t,!0,nK.exit)});function Wq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Hq;case"growRadius":return zq({...t,growField:"radius"});default:return zq({...t,growField:"angle"})}}const Uq={type:"fadeIn"};function Gq(t,e){return"fadeIn"===e?Uq:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function Yq(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const Xq=t=>({type:t.direction===Wh.horizontal?"growWidthOut":"growHeightOut",options:Yq(t)}),$q={type:"fadeIn"};function Kq(t,e){return!1===e?{}:"fadeIn"===e?$q:(t=>({type:t.direction===Wh.horizontal?"growWidthIn":"growHeightIn",options:Yq(t)}))(t)}const qq=t=>({type:"in"===t?"fadeIn":"fadeOut"});function Zq(t,e,i){return"fadeIn"===e?qq(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function Jq(t,e,i){return"fadeIn"===e?qq(i):((t,e)=>{const i=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const Qq=(t,e)=>({custom:RC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class tZ extends oC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;l(r)&&l(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);b(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);b(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class eZ extends EC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Ht(d,u,p,g);return f.defined=e.defined,f}}const iZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},nZ={type:"fadeIn"},sZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),rZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),aZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function oZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return nZ;case"growAngle":return iZ({...t,growField:"angle"});default:return iZ({...t,growField:"radius"})}}const lZ={type:"fadeIn"},hZ={type:"growCenterIn"};function cZ(t,e){switch(e){case"fadeIn":return lZ;case"scaleIn":return hZ;default:return Eq(t,!1)}}const dZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},uZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),pZ={type:"fadeIn"},gZ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function fZ(t,e){return"fadeIn"===e?pZ:uZ(t)}const mZ=t=>({custom:IC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),yZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},_Z=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},vZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===JN.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},bZ=(t,e,i)=>{if(M(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},xZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=bZ(r,n,s);return _Z(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=bZ(r,n,s);return _Z(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),SZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},wZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=SZ(r);return _Z(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=SZ(r);return _Z(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),AZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},kZ={type:"fadeIn"};function MZ(t){return!1===t?{}:kZ}const CZ={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},TZ={bar:(t,e)=>({appear:Iq(t,e),enter:Eq(t,!1),exit:Pq(t,!1),disappear:Pq(t)}),bar3d:(t,e)=>({appear:Iq(t,e),enter:Eq(t,!1),exit:Pq(t,!1),disappear:Pq(t)}),line:(t,e)=>({appear:Oq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:EC,duration:CZ.update.duration,easing:CZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:Cq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:Wq(t,e),enter:jq(t),exit:Nq(t),disappear:Vq(t)}),pie3d:(t,e)=>({appear:Wq(t,e),enter:jq(t),exit:Nq(t),disappear:Vq(t)}),rose:(t,e)=>({appear:oZ(t,e),enter:sZ(t),exit:rZ(t),disappear:aZ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:Zq(t,e,"in"),enter:Zq(t,e,"in"),exit:Zq(t,e,"out"),disappear:"clipIn"===e?void 0:Zq(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:eZ,customParameters:t,duration:CZ.update.duration,easing:CZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:Jq(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:Jq(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:tZ,customParameters:t,duration:CZ.update.duration,easing:CZ.update.easing}]}),radarGroup:(t,e)=>({appear:Qq(t,"in"),disappear:Qq(t,"out")}),circularProgress:(t,e)=>({appear:Gq(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:dZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:Kq(t,e),enter:{type:"grow"},disappear:Xq(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:BC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:BC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:mZ(t)}),rangeColumn:(t,e)=>({appear:fZ(t,e),enter:uZ(t),exit:gZ(t),disappear:gZ(t)}),waterfall:(t,e)=>({appear:cZ(t,e),enter:Eq(t,!1),exit:Pq(t,!1),disappear:Pq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:yZ(0,e),enter:xZ(t),exit:wZ(t),disappear:wZ(t)}),circlePacking:(t,e)=>({appear:AZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:MZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:uG},update:{custom:dG},exit:{custom:DC}})},EZ=["appear","enter","update","exit","disappear","normal"];function PZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=l(n)?n(t,s,r):b(n)?n:0;let h=l(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(o+h))},delete t.oneByOne,t}function IZ(t){return t?.[LX]}function DZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function LZ(t){return!function(t){return c(t.timeSlices)}(t)&&c(t.channel)}class OZ extends FK{static type=v$.rect;type=OZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class FZ extends FK{static type=v$.text;type=FZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}dK.useMark([OZ,FZ]);class zZ extends wq{static type=NK.bar;type=NK.bar;_barMarkName=jK.bar;_barMarkType=v$.rect;static mark={...Sq.mark,[jK.bar]:{name:jK.bar,type:v$.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...zZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:DZ(this._spec.animation,this._spec.morph,RZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===Wh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Nh(this.dataToPositionX(e),t),x1:e=>Nh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Fl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",HX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Fl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Nh(this.dataToPositionY(t),e),y1:t=>Nh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",HX.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Nh(this.dataToPositionX(e),t),x1:e=>Nh(this.dataToPositionX1(e),t),y:t=>Nh(this.dataToPositionY(t),e),y1:t=>Nh(this.dataToPositionY1(t),e)},"normal",HX.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(PZ(TZ.bar(t,e),RZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Aq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Aq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Aq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class HZ extends FK{static type=v$.rule;type=HZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}dK.useMark([HZ]);class jZ extends zZ{static type=NK.waterfall;type=NK.waterfall;static mark={...zZ.mark,[jK.leaderLine]:{name:jK.leaderLine,type:v$.rule},[jK.stackLabel]:{name:jK.stackLabel,type:v$.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],h(this._seriesField)&&(this._seriesField=DX)}getSeriesKeys(){return this._seriesField===DX?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),X$(this._dataSet,"waterfallFillTotal",KK),X$(this._dataSet,"waterfall",$K),(h(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=tK(this.getViewData(),this._dataSet,{name:`${$j}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new fq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jX,endAs:NX,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(PZ(TZ.waterfall(t,e),RZ(jK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec),{dataIndex:i}))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(jZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(jZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n}=this._xAxisHelper;return this._direction===Wh.vertical?n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("width",t)*i:Nh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n}=this._yAxisHelper;return this._direction===Wh.vertical?Nh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("height",t)*i}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===Wh.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",HX.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",HX.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===Wh.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const NZ=`${$j}_BOX_PLOT_OUTLIER_VALUE`;var VZ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(VZ||(VZ={}));const WZ=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];m(e)||(e=[e]),i.push(...e.map((e=>{const i={[NZ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class UZ extends hq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(VZ.OUTLIER),value:this.getContentValue(VZ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(VZ.MAX),value:this.getContentValue(VZ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.Q3),value:this.getContentValue(VZ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.MEDIAN),value:this.getContentValue(VZ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.Q1),value:this.getContentValue(VZ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.MIN),value:this.getContentValue(VZ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.SERIES_FIELD),value:this.getContentValue(VZ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===VZ.OUTLIER)return this.series.getOutliersField();if(t===VZ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case VZ.MIN:return this.series.getMinField();case VZ.MAX:return this.series.getMaxField();case VZ.MEDIAN:return this.series.getMedianField();case VZ.Q1:return this.series.getQ1Field();case VZ.Q3:return this.series.getQ3Field();case VZ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===VZ.OUTLIER)return e[NZ];if(t===VZ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case VZ.MIN:return e[this.series.getMinField()];case VZ.MAX:return e[this.series.getMaxField()];case VZ.MEDIAN:return e[this.series.getMedianField()];case VZ.Q1:return e[this.series.getQ1Field()];case VZ.Q3:return e[this.series.getQ3Field()];case VZ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>c(t[NZ])}class GZ extends FK{static type=v$.boxPlot;type=GZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(XN("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(eW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),KV("barBoxplotScaleIn",qV(tW)),KV("barBoxplotScaleOut",ZV(tW))):(XN("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(QV).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),KV("boxplotScaleIn",qV(JV)),KV("boxplotScaleOut",ZV(JV)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class YZ extends FK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:M$.circle,fill:void 0,lineWidth:0}}}class XZ extends YZ{static type=v$.symbol;type=XZ.type}dK.useMark([GZ,XZ]);class $Z extends wq{static type=NK.boxPlot;type=NK.boxPlot;static mark={...Sq.mark,[jK.boxPlot]:{name:jK.boxPlot,type:v$.boxPlot},[jK.outlier]:{name:jK.outlier,type:v$.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark($Z.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark($Z.mark.outlier,{progressive:t,key:LX,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===Wh.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,rK.STATE_NORMAL,HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:v(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},rK.STATE_NORMAL,HX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===Wh.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Nh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Nh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Nh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Nh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Nh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},rK.STATE_NORMAL,HX.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===Wh.vertical?{x:this.dataToPositionX.bind(this),y:e=>Nh(t(this.getDatumPositionValues(e,NZ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Nh(t(this.getDatumPositionValues(e,NZ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,rK.STATE_NORMAL,HX.Series)}}initData(){if(super.initData(),!this._data)return;X$(this._dataSet,"foldOutlierData",WZ),X$(this._dataSet,"addVChartProperty",QK);const t=new No(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${$j}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===Wh.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1),this._outlierDataView=new fq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===Wh.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===Wh.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===Wh.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(TZ.boxPlot()),i=this._initAnimationSpec(RZ(jK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(PZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(PZ(TZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new UZ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class KZ{setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([v$.line,v$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(qZ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",HX.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:k$},"normal",HX.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===A$?t===Wh.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",HX.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",HX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(qZ.point,{morph:DZ(this._spec.animation,this._spec.morph,RZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",HX.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?el(t[this.getStackValueField()]):"link"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?el(t[this.getStackValueField()]):"link"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series))}}const qZ={[jK.point]:{name:jK.point,type:v$.symbol},[jK.line]:{name:jK.line,type:v$.line}};class ZZ extends FK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((c=>{const d=t[c];if(h(d)||s.includes(c))return;a&&r.includes(c)&&(zl(d?.type)||d?.scale||l(d))&&(o=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class JZ extends ZZ{static type=v$.line;type=JZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===NK.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}dK.useMark([JZ,XZ,FZ]);class QZ extends wq{static type=NK.line;type=NK.line;_invalidType="break";static mark={...Sq.mark,...qZ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(PZ(TZ.line(t,e),RZ(jK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(PZ(TZ.symbol(),RZ(jK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}j(QZ,KZ);class tJ extends FK{static type=v$.rect3d;type=tJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}dK.useMark([tJ,FZ]);class eJ extends zZ{static type=NK.bar3d;type=NK.bar3d;static mark={...Sq.mark,[jK.bar3d]:{name:jK.bar3d,type:v$.rect3d}};_barMarkName=jK.bar3d;_barMarkType=v$.rect3d}function iJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===Wh.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if(l()===Wh.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=s(t),o=r(t);if(e===Wh.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===Wh.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",HX.Series)}class nJ extends hq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Wh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class sJ extends zZ{static type=NK.rangeColumn;type=NK.rangeColumn;_barMarkType=v$.rect;_barName=NK.bar;static mark={...zZ.mark,[jK.minLabel]:{name:jK.minLabel,type:v$.text},[jK.maxLabel]:{name:jK.maxLabel,type:v$.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(sJ.mark.bar,{morph:DZ(this._spec.animation,this._spec.morph,RZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===QX.bothEnd?void 0:L({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===QX.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(sJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(sJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Wh.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});iJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Wh.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});iJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===Wh.horizontal?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===Wh.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===Wh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Nh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Nh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Fl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",HX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Fl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Nh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Nh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",HX.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(PZ(TZ.rangeColumn({direction:this.direction},e),RZ(jK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new nJ(this)}}dK.useMark([tJ]);class rJ extends sJ{static type=NK.rangeColumn3d;type=NK.rangeColumn3d;_barMarkType=v$.rect3d;_barName=NK.bar3d}class aJ extends ZZ{static type=v$.area;type=aJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}dK.useMark([JZ,aJ,FZ,XZ]);class oJ extends wq{static type=NK.area;type=NK.area;static mark={...Sq.mark,...qZ,[jK.area]:{name:jK.area,type:v$.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(oJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===A$?this._direction===Wh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Wh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Nh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",HX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Nh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",HX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(i,{curveType:e},"normal",HX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(PZ(TZ.line(t,e),RZ(jK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(PZ(TZ.area(t,e),RZ(jK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(PZ(TZ.symbol(),RZ(jK.point,this._spec)))}}j(oJ,KZ);class lJ extends hq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Wh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class hJ extends oJ{static type=NK.rangeArea;type=NK.rangeArea;static mark={...oJ.mark};initMark(){this._areaMark=this._createMark(hJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===A$?this._direction===Wh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Wh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this)},"normal",HX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",HX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(i,{curveType:e},"normal",HX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new lJ(this)}}wr();const cJ={},dJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function uJ(t,e){t&&f(t)||rl("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(cJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=wr().projection(n),n.copy=n.copy||function(){const t=i();return dJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),cJ[i]||null}const pJ={albers:Vr,albersusa:function(){var t,e,i,n,s,r,a=Vr(),o=Nr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Nr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(pJ).forEach((t=>{uJ(t,pJ[t])}));const gJ="Feature",fJ="FeatureCollection";function mJ(t){const e=N(t);return 1===e.length?e[0]:{type:fJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===fJ?t.features:N(t).filter((t=>!h(t))).map((t=>t.type===gJ?t:{type:gJ,geometry:t}))}(e))),[])}}const yJ=dJ.concat(["pointRadius","fit","extent","size"]);function _J(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{yJ.includes(n)&&(i=i.concat(DN(t[n],e)))})),i):i}const vJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(h(i))for(let i=0;i(l(t),t)))};class bJ extends Sq{type=NK.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(h(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(h(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return h(r)||isNaN(r.x)||isNaN(r.y)?null:r}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${$j}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const xJ=(t,e)=>(t.features&&t.features.forEach((t=>{e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class SJ extends hq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class wJ extends FK{static type=v$.path;type=wJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var AJ,kJ,MJ;dK.useMark([wJ,FZ]),AJ="projection",kJ=class extends MW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return h(this.spec.pointRadius)||this.detach(DN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(DN(t,this.view)),this.commit(),this}size(t){return h(this.spec.size)||this.detach(DN(this.spec.size,this.view)),this.spec.size=t,this.attach(DN(t,this.view)),this.commit(),this}extent(t){return h(this.spec.extent)||this.detach(DN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(DN(t,this.view)),this.commit(),this}fit(t){return h(this.spec.fit)||this.detach(DN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(DN(t,this.view)),this.commit(),this}configure(t){return this.detach(_J(this.spec,this.view)),h(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(_J(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=uJ((t||"mercator").toLowerCase());return e||rl("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),dJ.forEach((t=>{var i,n,s;h(this.spec[t])||(i=this.projection,n=t,s=ON(this.spec[t],e,uJ),l(i[n])&&i[n](s))})),h(this.spec.pointRadius)||this.projection.path.pointRadius(ON(this.spec.pointRadius,e,uJ)),!(h(this.spec.fit)||h(this.spec.extent)&&h(this.spec.size))){const t=mJ(ON(this.spec.fit,e,uJ));this.spec.extent?this.projection.fitExtent(ON(this.spec.extent,e,uJ),t):this.spec.size&&this.projection.fitSize(ON(this.spec.size,e,uJ),t)}return this.projection}output(){return this.projection}},MJ="projections",aX[AJ]={grammarClass:kJ,specKey:null!=MJ?MJ:AJ};class CJ extends bJ{static type=NK.map;type=NK.map;static mark={...Sq.mark,[jK.area]:{name:jK.area,type:v$.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),!this.map)throw new Error(`map type '${this.map}' is not specified !`);if(!K$.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),X$(this._dataSet,"copyDataView",Q$),X$(this._dataSet,"map",xJ),X$(this._dataSet,"lookup",vJ);const t=K$.get(this.map);if(!t)throw Error("no valid map data found!");const e=new No(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??FX,OX],as:[this.nameField,this.valueField,this._seriesField??FX,OX]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new fq(this._option,e)}initMark(){this._pathMark=this._createMark(CJ.mark.area,{morph:DZ(this._spec.animation,this._spec.morph,RZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(CJ.mark.label,{skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>c(t[this._seriesField??FX])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??FX]):this._theme?.defaultFillColor,path:this.getPath.bind(this)},"normal",HX.Series),this.setMarkStyle(t,{smoothScale:!0},"normal",HX.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(PZ(TZ.path(),RZ(jK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec)))}initTooltip(){this._tooltipHelper=new SJ(this)}getPath(t){const e=this._areaCache.get(t?.properties?.[this._nameProperty]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t?.properties?.[this._nameProperty],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===v$.path?s.forEach((t=>{t.getGraphicItem().scale(e,e,i)})):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===v$.path?n.forEach((t=>{t.getGraphicItem().translate(e[0],e[1])})):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return b(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]??t.properties?.[this.nameField]??""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return t=>t?.properties?.[this._nameProperty]}}class TJ extends Sq{coordinate="polar";_outerRadius=AN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=c(t)?N(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=c(t)?N(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=N(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(h(t)||h(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(t)),n=this.radiusAxisHelper.dataToPosition(N(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};Fl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};Fl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),c(this._spec.radius)&&(this._outerRadius=this._spec.radius),c(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Wo(t.angleField,i)&&Wo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const EJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=bl(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},PJ=(t,e)=>{const i=t[0].latestData;return new BJ(e.series,i).updateLabels()};class RJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class BJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=h$(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[tN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:c}=n;if("inside"!==t?.position){const t=Al(e.x,e.y,this._series.computeDatumRadius(s,rK.STATE_HOVER),n.middleAngle),i=Al(e.x,e.y,this._series.computeDatumRadius(s,rK.STATE_SELECTED),n.middleAngle),a=Al(e.x,e.y,this._series.computeDatumRadius(s,rK.STATE_NORMAL),n.middleAngle);s[hN]=a.x,s[cN]=a.y,s[oN]=t.x,s[lN]=t.y,s[fN]=i.x,s[mN]=i.y,s[dN]=l.x,s[uN]=l.y,s[pN]=c.x,s[gN]=c.y,s[iN]=r.y-o.height/2}else s[iN]=r.y;return s[Jj]=this._computeAlign(n),s[Zj]=Math.max(a,0),s[tN]=n.labelVisible&&!h(n.labelText),s[eN]=r.x,s[Qj]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=Al(e.x,e.y,f,t.middleAngle),t.labelLimit=p,at(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=kl(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=kl(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(ot(t.pointB.x,n+r)||at(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?vl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?h(i)||"auto"===i?"edge"===n?kl(t.quadrant)?"left":"right":kl(t.quadrant)?"right":"left":i:h(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=h(n)||h(t[n])||h(t[s]);return l(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class IJ extends FK{type=DJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+wl({angle:e[yN],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class DJ extends IJ{static type=v$.arc;type=DJ.type}dK.useMark([wJ,FZ,DJ]);class LJ extends TJ{_pieMarkName=jK.pie;_pieMarkType=v$.arc;static mark={...Sq.mark,[jK.pie]:{name:jK.pie,type:v$.arc},[jK.labelLine]:{name:jK.labelLine,type:v$.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=bN;_endAngle=xN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=c(t),r=c(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(c(this._spec?.startAngle)?xl(this._spec.startAngle):this._startAngle,c(this._spec?.endAngle)?xl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=c(this._spec?.padAngle)?xl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;X$(this._dataSet,"pie",EJ),X$(this._dataSet,"arcLabel",PJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:sN,asEndAngle:rN,asRatio:nN,asMiddleAngle:yN,asRadian:vN,asQuadrant:_N,asK:aN}},!1);const e=new No(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${$j}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new fq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...LJ.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:DZ(this._spec.animation,this._spec.morph,RZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark(LJ.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark(LJ.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Vh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Vh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ll(sN).bind(this),endAngle:Ll(rN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",HX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,HX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Ll(tN).bind(this),x:Ll(eN).bind(this),y:Ll(iN).bind(this),text:Ll(Qj).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ll(Jj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[yN];return"inside"===this._spec.label?.position?Sl(e):0},limit:Ll(Zj).bind(this)},void 0,HX.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Ll(tN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(RX.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return t?.outerRadius&&(e.outerRadius=()=>this.computeLayoutRadius()*t?.outerRadius),t?.innerRadius&&(e.innerRadius=()=>this.computeLayoutRadius()*t?.innerRadius),t?.cornerRadius&&(e.cornerRadius=()=>this.computeLayoutRadius()*t?.cornerRadius),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${$j}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${$j}_ARC_LABEL_${e}_AY`])} L${Math.round(t[dN])},${Math.round(t[uN])} L${Math.round(t[pN])},${Math.round(t[gN])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(h(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[yN];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=wl({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[yN];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=wl({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===nK.appear)return this._startAngle;if(i===nK.disappear)return this._endAngle;const n=[nK.disappear,nK.exit],s=e.mark.elements,r=t,a=r?.[LX];if(void 0===s.find((t=>t.data[0]?.[LX]t.data[0]?.[LX]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[LX]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+wl({angle:e[yN],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+wl({angle:e[yN],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+wl({angle:e[yN],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+wl({angle:e[yN],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class OJ extends LJ{static type=NK.pie;type=NK.pie}class FJ extends IJ{static type=v$.arc3d;type=FJ.type}dK.useMark([wJ,FZ,FJ]);class zJ extends LJ{static type=NK.pie3d;type=NK.pie3d;_pieMarkName=jK.pie3d;_pieMarkType=v$.arc3d;static mark={...Sq.mark,[jK.pie3d]:{name:jK.pie3d,type:v$.arc3d},[jK.labelLine]:{name:jK.labelLine,type:v$.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ll(sN).bind(this),endAngle:Ll(rN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",HX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,HX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Ll(eN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Ll(iN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Ll(tN).bind(this),x:Ll(eN).bind(this),y:Ll(iN).bind(this),text:Ll(Qj).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ll(Jj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[yN];return"inside"===this._spec.label?.position?Sl(e):0},limit:Ll(Zj).bind(this),...n},void 0,HX.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Ll(tN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const HJ=[10,20],jJ=Ol.Linear,NJ="circle",VJ=Ol.Ordinal,WJ=["circle","square","triangle","diamond","star"];dK.useMark([XZ,FZ]);class UJ extends wq{static type=NK.scatter;type=NK.scatter;static mark={...Sq.mark,[jK.point]:{name:jK.point,type:v$.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if(l(e))return e;if(m(e)){if(h(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${$j}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(d(e)){if(h(t))throw new Error(`${s}Field is required.`);const r={id:`${$j}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return h(e)?10:v(e)?e:!f(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:jJ,defaultRange:HJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return h(e)?NJ:f(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:VJ,defaultRange:WJ},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(UJ.mark.point,{morph:DZ(this._spec.animation,this._spec.morph,RZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(PZ(TZ.scatter({},t),RZ(jK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:v(this._size)||l(this._size)?this._size:10,shape:f(this._shape)||l(this._shape)?this._shape:NJ},rK.STATE_NORMAL,HX.Series),(c(this._sizeField)||c(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},rK.STATE_NORMAL,HX.User_Mark),(c(this._shapeField)||c(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},rK.STATE_NORMAL,HX.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||el(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},rK.STATE_NORMAL,HX.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class GJ extends TJ{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(NX),this.setInnerRadiusField(jX)}setValueFieldToPercent(){this.setRadiusField(WX),this.setInnerRadiusField(VX)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}dK.useMark([DJ,FZ]);class YJ extends GJ{static type=NK.rose;type=NK.rose;static mark={...zZ.mark,[jK.rose]:{name:jK.rose,type:v$.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(YJ.mark.rose,{morph:DZ(this._spec.animation,this._spec.morph,RZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(YJ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Nh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Nh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Nh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(Sl(e)??0)+90},void 0,HX.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(PZ(TZ.rose(e,t),RZ(jK.rose,this._spec)))}}}dK.useMark([aJ,JZ,XZ,FZ]);class XJ extends GJ{static type=NK.radar;type=NK.radar;static mark={...Sq.mark,...qZ,[jK.area]:{name:jK.area,type:v$.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(XJ.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:k$},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:xl(this._spec.startAngle)??bN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(PZ(TZ.radarGroup(t,e),RZ(jK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(c(i)){const s=TZ[n];i.setAnimationConfig(PZ(s(t,e),RZ(i.name,this._spec)))}}))}}j(XJ,KZ);class $J extends hq{updateTooltipSpec(){super.updateTooltipSpec(),c(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>Vo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const KJ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},qJ={fill:"#bbb",fillOpacity:.2};dK.useMark([XZ,FZ,HZ,OZ]);class ZJ extends wq{static type=NK.dot;type=NK.dot;static mark={...Sq.mark,[jK.group]:{name:jK.group,type:v$.group},[jK.grid]:{name:jK.grid,type:v$.rule},[jK.gridBackground]:{name:jK.gridBackground,type:v$.rect},[jK.dot]:{name:jK.dot,type:v$.symbol},[jK.title]:{name:jK.title,type:v$.text},[jK.subTitle]:{name:jK.subTitle,type:v$.text},[jK.symbol]:{name:jK.symbol,type:v$.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){c(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){c(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){c(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){c(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){c(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),X$(this._option.dataSet,"objFlat",KJ),X$(this._option.dataSet,"copyDataView",Q$),$$(this._option.dataSet,"dataview",Oo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([v$.line,v$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(L(qJ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(ZJ.mark.group),this._containerMark=this._createMark(ZJ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(ZJ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(ZJ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(ZJ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(ZJ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(ZJ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(ZJ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",HX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",HX.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",HX.Series),this._trigger.registerMark(i));const n=this._gridMark;n&&(this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",HX.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",HX.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",HX.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",HX.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(o))}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??FX}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Bh(this._option.getTheme().colorScheme,this.type);return(new zh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??FX}}initTooltip(){this._tooltipHelper=new $J(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class JJ extends hq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>Vo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}dK.useMark([HZ,XZ]);class QJ extends wq{static type=NK.link;type=NK.link;static mark={...Sq.mark,[jK.group]:{name:jK.group,type:v$.group},[jK.link]:{name:jK.link,type:v$.rule},[jK.arrow]:{name:jK.arrow,type:v$.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){c(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){c(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){c(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();X$(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(QJ.mark.group),this._containerMark=this._createMark(QJ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(QJ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(QJ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",HX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",HX.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",HX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?M$.triangleDown:M$.triangleUp},"normal",HX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??FX}}initTooltip(){this._tooltipHelper=new JJ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class tQ extends TJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=xl(this._spec.startAngle)??xl(t?.startAngle)??bN,this._endAngle=xl(this._spec.endAngle)??xl(t?.endAngle)??xN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||c(n?.startAngle)||c(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Nh(this.angleAxisHelper.dataToPosition([t[jX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Nh(this.angleAxisHelper.dataToPosition([t[NX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class eQ extends IJ{static type=v$.arc;static constructorType=v$.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){c(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),c(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const h=c(t.innerPadding)&&c(a)||c(t.outerPadding)&&c(o),d=c(t.innerRadius)&&s||c(t.outerRadius)&&r;if(h||d){const e=Object.assign({},t);return s&&c(a)&&(l(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+(l(s)?s(t,e,i,n):s):l(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&c(o)&&(l(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-(l(r)?r(t,e,i,n):r):l(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}dK.useMark([DJ,eQ]);class iQ extends tQ{static type=NK.circularProgress;type=NK.circularProgress;static mark={...Sq.mark,[jK.track]:{name:jK.track,type:v$.progressArc},[jK.progress]:{name:jK.progress,type:v$.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(iQ.mark.track),this._progressMark=this._createMark(iQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(PZ(TZ.circularProgress({startAngle:this._startAngle},t),RZ(jK.progress,this._spec))),this._trackMark.setAnimationConfig(PZ(TZ.progressBackground(),RZ(jK.track,this._spec)))}}class nQ extends hq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}dK.useMark([OZ]);class sQ extends wq{static type=NK.linearProgress;type=NK.linearProgress;static mark={...Sq.mark,[jK.track]:{name:jK.track,type:v$.rect},[jK.progress]:{name:jK.progress,type:v$.rect},[jK.group]:{name:jK.group,type:v$.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(sQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Nh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Nh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Nh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Nh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(sQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Nh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Nh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(sQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Nh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(lB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Nh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(lB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",HX.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(PZ(TZ.linearProgress(t,e),RZ(jK.progress,this._spec))),this._trackMark.setAnimationConfig(PZ(TZ.progressBackground(),RZ(jK.track,this._spec)))}initTooltip(){this._tooltipHelper=new nQ(this)}}const rQ=[0],aQ=[20,40],oQ=[200,500],lQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},hQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],cQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:dQ,triangle:dQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function dQ(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function uQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const pQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function gQ(t){return l(t)?t:function(){return t}}class fQ{constructor(t){var e,i;switch(this.options=Object.assign({},fQ.defaultOptions,t),l(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>cQ[t]?cQ[t]():cQ.circle())(this.options.shape),this.getText=null!==(e=gQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=gQ(this.options.fontWeight),this.getTextFontSize=gQ(this.options.fontSize),this.getTextFontStyle=gQ(this.options.fontStyle),this.getTextFontFamily=gQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>pQ(10,50);break;case"random-light":this.getTextColor=()=>pQ(50,90);break;default:this.getTextColor=gQ(this.options.color)}if(h(this.options.rotate)){if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}}else this.getTextRotate=l(this.options.rotate)?t=>{var e;return Ut(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Ut(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!h(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class yQ extends fQ{constructor(t){var e;super(Object.assign({},yQ.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.spiral=f(this.options.spiral)?null!==(e=mQ[this.options.spiral])&&void 0!==e?e:mQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=gQ(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:n}=uQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));for(this.data=r;s>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(xQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(bQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}xQ(p,this._size)&&(p=SQ(p,this._size))}else if(xQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||vQ(p,i))&&(!i||!_Q(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function _Q(t,e,i){const n=i[0]>>5,s=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function vQ(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,xQ=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function SQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),G(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=uQ(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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(;ie.left+e.width||t.top>e.top+e.height)}AQ.defaultOptions={enlarge:!1};const MQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},CQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?TQ(t.fontFamily):"sans-serif",u=t.fontStyle?TQ(t.fontStyle):"normal",p=t.fontWeight?TQ(t.fontWeight):"normal",g=t.rotate?TQ(t.rotate):0,f=TQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?TQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",b=null!==(r=t.shrink)&&void 0!==r&&r,x=null!==(a=t.enlarge)&&void 0!==a&&a,S=null!==(o=t.clip)&&void 0!==o&&o,w=null!==(l=t.minFontSize)&&void 0!==l?l:0,A=t.randomVisible,k=t.as||MQ,M=t.depth_3d,C=t.postProjection;let T=t.fontSize?TQ(t.fontSize):14;const E=t.fontSizeRange;if(E&&!v(T)){const t=T;T=e=>EQ(t(e),PQ(t,h),E)}let P=yQ;"fast"===t.layoutType?P=AQ:"grid"===t.layoutType&&(P=wQ);const R=new P({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:T,shrink:b,clip:S,enlarge:x,minFontSize:w,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},TQ=t=>f(t)||v(t)||l(t)?t:e=>e[t.field],EQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],PQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function RQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),DQ=(t,e)=>{let i=0;for(const e of t)IQ(e)?i+=1:i+=.53;return i};function LQ(t){return x(t)?new Promise(((e,i)=>{const n=uB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{Ve.getInstance().error("image 加载失败!",t)}})):null}var OQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function FQ(t){return OQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield LQ(e);r&&(a=yield function(t,e,i){return OQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&HQ(s,n,a-1);)--a;for(;oo&&jQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield LQ(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||zQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function zQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function HQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=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")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||UQ(e,t,r)))return WQ(e,t,r),!0}return!1}function WQ(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function UQ(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function GQ(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(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,s,u).data;let f,m;for(;--n>=p;){const t=i[n];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;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(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 YQ(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=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++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=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?NQ(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=YQ(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return NQ(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){GQ(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!UQ(i,y,_)&&(WQ(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var KQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const qQ={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},ZQ=(t,e,i,n)=>KQ(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||rl("WordcloudShape shape must be specified."),t.text||rl("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(BQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||qQ;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=pj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield FQ(l),p=t.colorMode||"ordinal",g={getText:i0(t.text),getFontSize:i0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?i0(t.colorField):i0(t.text),getFillingColor:i0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:i0(t.colorHexField),getFontFamily:i0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:i0(t.padding||1),getFontStyle:i0(t.fontStyle||"normal"),getFontWeight:i0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?i0(t.fontOpacity):()=>1};QQ(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:i0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:i0(t.fillingFontStyle||"normal"),getFillingFontWeight:i0(t.fillingFontWeight||"normal"),getFillingPadding:i0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((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{const i=DQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,P=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),R=Math.max(...P.map((t=>t.fontSize)));P.forEach((t=>t.weight=t.fontSize/R)),P.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield $Q(P,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(BQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),JQ=(t,e,i,n)=>{var s,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 Vl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Vl).domain(e).range(f).scale(t)}}else(new yh).domain(e0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new yh).domain(e0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},QQ=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new kh).domain(e0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&l(s)&&!n){const e=.5,[o,l]=(i.shapeArea,e0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=t0(h,i,!0);n=[~~(e*c),~~c];const d=(new kh).domain(e0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=t0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},t0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=DQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},i0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:l(t)?t:e=>e[t.field]:null,n0=`${$j}_WORD_CLOUD_ANGLE`,s0=`${$j}_WORD_CLOUD_FILLING_ANGLE`,r0=`${$j}_WORD_CLOUD_WEIGHT`,a0=`${$j}_WORD_CLOUD_TEXT`;dK.useMark([FZ]),CN("wordcloud",{transform:CQ,markPhase:"beforeJoin"},!0),CN("wordcloudShape",{transform:ZQ,markPhase:"beforeJoin"},!0);class o0 extends Sq{static mark={...Sq.mark,[jK.word]:{name:jK.word,type:v$.text},[jK.fillingWord]:{name:jK.fillingWord,type:v$.text}};_nameField;_valueField;setValueField(t){c(t)&&(this._valueField=t,this.setFontSizeRange(aQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){c(t)&&c(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??oQ,this._rotateAngles=this._spec.rotateAngles??rQ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:lQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:rQ,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!hQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(o0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(o0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?a0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",HX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(PZ(TZ.wordCloud(),RZ(jK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Bh(this._option.getTheme().colorScheme,this.type);return(new zh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??FX};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new yh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=pl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:r0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:n0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:s0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:a0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?a0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:OX,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?a0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:qo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:OX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:n0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class l0 extends o0{static type=NK.wordCloud;type=NK.wordCloud}class h0 extends o0{static type=NK.wordCloud3d;type=NK.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new yh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=pl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:r0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:n0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:s0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:a0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?a0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:OX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:OX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:n0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(o0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(o0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",HX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(PZ(TZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),RZ(jK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(PZ(TZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),RZ(jK.fillingWord,this._spec)))}}const c0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=b(y*f)?y/f:null,x=b(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:x),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},d0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},u0=`${$j}_FUNNEL_TRANSFORM_RATIO`,p0=`${$j}_FUNNEL_REACH_RATIO`,g0=`${$j}_FUNNEL_HEIGHT_RATIO`,f0=`${$j}_FUNNEL_VALUE_RATIO`,m0=`${$j}_FUNNEL_LAST_VALUE_RATIO`,y0=`${$j}_FUNNEL_NEXT_VALUE_RATIO`,_0=`${$j}_FUNNEL_LAST_VALUE`,v0=`${$j}_FUNNEL_CURRENT_VALUE`,b0=`${$j}_FUNNEL_NEXT_VALUE`,x0=`${$j}_FUNNEL_TRANSFORM_LEVEL`,S0=20;class w0 extends hq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===jK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===jK.transform){const e=t?.[p0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===jK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])?t?.[n[0]]:t?.[s]}}class A0 extends FK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class k0 extends A0{static type=v$.polygon;type=k0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}dK.useMark([k0,FZ,HZ]);class M0 extends Sq{static type=NK.funnel;type=NK.funnel;_funnelMarkName=jK.funnel;_funnelMarkType=v$.polygon;_transformMarkName=jK.transform;_transformMarkType=v$.polygon;static mark={...Sq.mark,[jK.funnel]:{name:jK.funnel,type:v$.polygon},[jK.transform]:{name:jK.transform,type:v$.polygon},[jK.transformLabel]:{name:jK.transformLabel,type:v$.text},[jK.outerLabel]:{name:jK.outerLabel,type:v$.text},[jK.outerLabelLine]:{name:jK.outerLabelLine,type:v$.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",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._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;X$(this._dataSet,"funnel",c0),X$(this._dataSet,"funnelTransform",d0);const t=new No(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${$j}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new fq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:v0,asTransformRatio:u0,asReachRatio:p0,asHeightRatio:g0,asValueRatio:f0,asNextValueRatio:y0,asLastValueRatio:m0,asLastValue:_0,asNextValue:b0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:x0}})}initMark(){if(this._funnelMark=this._createMark({...M0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:DZ(this._spec.animation,this._spec.morph,RZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...M0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(M0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(M0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(M0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(M0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new w0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>c(t[this._valueField]),fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",HX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Ll(p0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",HX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",HX.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",HX.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(PZ(TZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),RZ(jK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(PZ(TZ.funnel({},t),RZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(PZ(TZ.label(),RZ(jK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[m0])/2:this._getSecondaryAxisLength(t[f0])/2,s=this._getSecondaryAxisLength(t[f0])/2):(n=this._getSecondaryAxisLength(t[f0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[y0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[x0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return c(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!c(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(v(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-S0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",HX.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",HX.Series)}}function E0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=B0(t.children,u.children,i+1,o,u,r);u.value=h(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else u.isLeaf=!0,u.value=h(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:l,flattenIndex:o}},I0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=I0(t.children,e,t,s))})),n},D0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=D0(t.children,e,t,s)),s=e(t,n,i,s)})),s},L0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:E0,slice:P0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?P0:E0)(t,e,i,n,s)}};class O0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},O0.defaultOpionts,t);const i=this.options.nodeKey,n=l(i)?i:i?ol(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?R0(this.options.aspectRatio):null!==(e=L0[this.options.splitType])&&void 0!==e?e:L0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},s=[],r=B0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(v(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(v(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}O0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const F0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class z0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];E0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),F0);const n=m(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],n)return this._layoutLabel(t,o(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},z0.defaultOpionts,t):Object.assign({},z0.defaultOpionts);const e=this.options.nodeKey,i=l(e)?e:e?ol(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+fl(this.options.center[0],t.width),n=t.y0+fl(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=m(r),l=o?r.map((t=>fl(t,s))):fl(r,s),c=m(a),d=this.options.gapRadius,u=c?a.map((t=>fl(t,s))):fl(a,s),p=Y(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return h(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:ih(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(m(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=fl(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(m(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],s=B0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=$t({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}z0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const H0=4294967296;function j0(t,e){let i,n;if(W0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function W0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function X0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function $0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function K0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function q0(t){return{_:t,next:null,prev:null}}function Z0(t,e){const i=(t=N(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];X0(s,n,r);let a,o,l,h,c,d,u,p=q0(n),g=q0(s),f=q0(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:m(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const h=[],c=B0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%H0)/H0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=l(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:e1.defaultOpionts.nodeSort;I0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)I0([u],J0(this.options.setRadius)),D0([u],Q0(this._getPadding,.5,d)),I0([u],t1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);I0([u],J0(e1.defaultOpionts.setRadius)),D0([u],Q0(hl,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&D0([u],Q0(this._getPadding,u.radius/t,d)),I0([u],t1(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}e1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const i1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):i1(t.children,e,i)))})),e},n1=(t,e={})=>{if(!t)return[];const i=[];return i1(t,i,e),i},s1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new z0(i).layout(t,{width:n,height:s})};class r1 extends hq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var a1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(a1||(a1={}));const o1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(h(s))return t;if(i.type===a1.DrillDown){return N(g$(t,s,n,"children"))}if(i.type===a1.DrillUp){const e=f$(t,s,n,"children");if(e)return N(e)}return t};class l1{pointerId;parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}parserDragEvent(){return!0}}class h1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!0)}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}}const c1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:l1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:l1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:h1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:h1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:h1}};class d1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return c1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===dn.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;X$(t,"drillFilter",o1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(h(t.datum)||h(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!m(t)||M(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:a1.DrillDown},e().reRunAllTransform(),i.emit(RX.drill,{value:{path:t,type:a1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!m(i)||M(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:a1.DrillUp},t().reRunAllTransform(),e.emit(RX.drill,{value:{path:i,type:a1.DrillUp},model:this}),i}}dK.useMark([DJ,FZ]);class u1 extends TJ{static type=NK.sunburst;type=NK.sunburst;static mark={...Sq.mark,[jK.sunburst]:{name:jK.sunburst,type:v$.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??yq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??OX,getRawData:()=>this.getRawData()}),this._startAngle=Ut(this._spec.startAngle),this._endAngle=Ut(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),X$(this._dataSet,"sunburstLayout",s1),X$(this._dataSet,"flatten",n1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[c(this._centerX)?this._centerX:this.getLayoutRect().width/2,c(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mq,operations:["max","min","values"]},{key:yq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(X$(t.dataSet,"addVChartProperty",QK),t.transform({type:"addVChartProperty",options:{beforeCall:vq,call:xq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(u1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){h(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.y+(c(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rK.STATE_NORMAL,HX.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(u1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return d(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(c(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},rK.STATE_NORMAL,HX.Series)}initTooltip(){this._tooltipHelper=new r1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(v$.arc).forEach((i=>{i.setAnimationConfig(PZ(TZ.sunburst(t,e),RZ(i.name,this._spec)))})),this.getMarksInType(v$.text).forEach((t=>{t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(m(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}j(u1,d1);const p1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new e1(i).layout(t,{width:n,height:s})};class g1 extends hq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}dK.useMark([DJ,FZ]);class f1 extends wq{static type=NK.circlePacking;type=NK.circlePacking;static mark={...Sq.mark,[jK.circlePacking]:{name:jK.circlePacking,type:v$.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??yq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??OX,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();h(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),X$(this._dataSet,"circlePackingLayout",p1),X$(this._dataSet,"flatten",n1),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{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(X$(t.dataSet,"addVChartProperty",QK),t.transform({type:"addVChartProperty",options:{beforeCall:vq,call:xq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(f1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){h(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},rK.STATE_NORMAL,HX.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(f1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rK.STATE_NORMAL,HX.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mq,operations:["max","min","values"]},{key:yq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new g1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(v$.arc).forEach((e=>{e.setAnimationConfig(PZ(TZ.circlePacking({},t),RZ(e.name,this._spec)))})),this.getMarksInType(v$.text).forEach((t=>{t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}j(f1,d1);const m1=t=>{let e=0;return t.forEach(((t,i)=>{var n;h(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=m1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function y1(t){return t.depth}function _1(t,e){return e-1-t.endDepth}const v1=(t,e)=>t.y0-e.y0,b1={left:y1,right:_1,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?W(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:y1,end:_1};class x1{constructor(t){this._ascendingSourceBreadth=(t,e)=>v1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>v1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},x1.defaultOptions,t);const e=this.options.nodeKey,i=l(e)?e:e?ol(e):null;this._getNodeKey=i,this._alignFunc=l(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):b1[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];m1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(h(s.source)||h(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&rl("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&rl("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(f(e)){const t=ct(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(v(e)){if(r=e,v(i))a=i;else if(h(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else l(e)&&v(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}h(this.options.nodeSortBy)&&s.sort(v1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(v1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new x1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},w1=(t,e)=>{if(!t||!e?.view||!m(t))return t;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 t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new x1(e),s=[];return s.push(n.layout(t,i)),s},A1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],k1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class M1 extends hq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(v(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class C1 extends FK{static type=v$.linkPath;type=C1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){XN("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(sW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),KV("linkPathGrowIn",rW),KV("linkPathGrowOut",aW),KV("linkPathUpdate",oW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}dK.useMark([OZ,C1,FZ]),CN("sankey",{transform:S1,markPhase:"beforeJoin"},!0);class T1 extends wq{static type=NK.sankey;type=NK.sankey;static mark={...zZ.mark,[jK.node]:{name:jK.node,type:v$.rect},[jK.link]:{name:jK.link,type:v$.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=$X.Node;_labelLayoutZIndex=$X.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Vt;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){X$(this._dataSet,"sankey",w1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new Ho;$$(t,"dataview",Oo),X$(t,"sankeyNodes",A1),X$(t,"addVChartProperty",QK);const e=new No(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1),this._nodesSeriesData=new fq(this._option,e);const i=new Ho;$$(i,"dataview",Oo),X$(i,"sankeyLinks",k1),X$(i,"addVChartProperty",QK);const n=new No(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1),this._linksSeriesData=new fq(this._option,n)}}initMark(){const t=this._createMark(T1.mark.node,{isSeriesMark:!0,key:LX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(T1.mark.link,{key:LX,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(T1.mark.label,{key:LX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},rK.STATE_NORMAL,HX.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},rK.STATE_NORMAL,HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rK.STATE_NORMAL,HX.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(PZ(TZ.sankeyNode(t,e),RZ(jK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(PZ(TZ.sankeyLinkPath(),RZ(jK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:IX.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:IX.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:IX.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:IX.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(N(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||N(s[r]).includes(e.source)&&N(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(N(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new M1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Bh(this._option.getTheme().colorScheme,this.type),n=new zh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const E1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new O0(e).layout(t,i)},P1=(t,e)=>{let i={},n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=n1(s);return i=pq([{latestData:r}],e),i};class R1 extends hq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class B1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,c1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return c1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:IX.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:IX.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;h(s)||Gh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){c1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){c1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){c1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){c1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:IX.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:IX.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;h(s)&&h(r)||Gh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:IX.chart},(t=>{if(!t.event)return;const{event:n}=t;Gh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:IX.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){c1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:IX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){c1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:IX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:IX.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:IX.chart,source:BX.chart},l),this._eventObj.off(n,{level:IX.chart,source:BX.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:IX.chart,source:BX.chart},l),this._eventObj.on(n,{level:IX.chart,source:BX.chart},o)}}dK.useMark([OZ,FZ]);class I1 extends wq{static type=NK.treemap;type=NK.treemap;static mark={...Sq.mark,[jK.nonLeaf]:{name:jK.nonLeaf,type:v$.rect},[jK.leaf]:{name:jK.leaf,type:v$.rect},[jK.nonLeafLabel]:{name:jK.nonLeafLabel,type:v$.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Vt;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??yq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qt),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??OX,getRawData:()=>this.getRawData()}),b(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),X$(this._dataSet,"treemap",E1),X$(this._dataSet,"flatten",n1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(X$(this._rawData.dataSet,"addVChartProperty",QK),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vq,call:xq.bind(this)}}))}_statisticRawData(){const t=`${$j}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){X$(this._dataSet,"hierarchyDimensionStatistics",P1),X$(this._dataSet,"flatten",n1);const i=new No(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 super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mq,operations:["max","min","values"]},{key:yq,operations:["values"]}])}initMark(){const t=this._createMark(I1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(I1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(I1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(I1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},rK.STATE_NORMAL,HX.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()},rK.STATE_NORMAL,HX.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rK.STATE_NORMAL,HX.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rK.STATE_NORMAL,HX.Series)}initAnimation(){this.getMarksInType(v$.rect).forEach((t=>{t.setAnimationConfig(PZ(TZ.treemap(),RZ(t.name,this._spec)))})),this.getMarksInType(v$.text).forEach((t=>{t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))}))}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 R1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(lV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(lV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}j(I1,B1),j(I1,d1),dK.useMark([wJ,OZ]);class D1 extends tQ{static type=NK.gaugePointer;type=NK.gaugePointer;static mark={...Sq.mark,[jK.pin]:{name:jK.pin,type:v$.path},[jK.pinBackground]:{name:jK.pinBackground,type:v$.path},[jK.pointer]:{name:jK.pointer,type:[v$.path,v$.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?v$.rect:v$.path}initMark(){this._pinBackgroundMark=this._createMark(D1.mark.pinBackground),this._pointerMark=this._createMark({...D1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(D1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===v$.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return c(this.radiusAxisHelper)&&c(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(PZ(TZ.circularProgress({startAngle:this._startAngle},t),RZ(jK.pointer,this._spec)))}}dK.useMark([eQ]);class L1 extends tQ{static type=NK.gauge;type=NK.gauge;static mark={...Sq.mark,[jK.segment]:{name:jK.segment,type:v$.progressArc},[jK.track]:{name:jK.track,type:v$.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=xl(this._spec.padAngle??0)}initData(){super.initData();X$(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[XX]=t[this._angleField[0]],t[YX]=e>0?i[e-1][XX]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(L1.mark.track),this._segmentMark=this._createMark(L1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(c(t[YX])?this.angleAxisHelper.dataToPosition([t[YX]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[XX]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(PZ(TZ.circularProgress({startAngle:this._startAngle},t),RZ(jK.segment,this._spec)))}}class O1 extends hq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return c(i)&&"dimension"===t&&(i.visible=!1),i}}class F1 extends YZ{static type=v$.cell;type=F1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}dK.useMark([F1,FZ]);class z1 extends wq{static type=NK.heatmap;type=NK.heatmap;static mark={...Sq.mark,[jK.cell]:{name:jK.cell,type:v$.cell},[jK.cellBackground]:{name:jK.cellBackground,type:v$.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=N(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(z1.mark.cell,{morph:DZ(this._spec.animation,this._spec.morph,RZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(z1.mark.cellBackground,{progressive:t})}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",HX.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=We(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",HX.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(PZ(TZ.heatmap(t),RZ(jK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new O1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}dK.useSeries([oJ]);class H1 extends YK{static type=VK.area;static view="singleDefault";type=VK.area;seriesType=NK.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([zZ]);class j1 extends YK{static type=VK.bar;static view="singleDefault";type=VK.bar;seriesType=NK.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([eJ]);class N1 extends YK{static type=VK.bar3d;static view="singleDefault";type=VK.bar3d;seriesType=NK.bar3d}dK.useSeries([$Z]);class V1 extends YK{static type=VK.boxPlot;static view="singleDefault";type=VK.boxPlot;seriesType=NK.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??Wh.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===Wh.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),XK(t)}}dK.useSeries([f1]);class W1 extends GK{static type=VK.circlePacking;static view="singleDefault";type=VK.circlePacking;seriesType=NK.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=NK.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class U1 extends GK{static type=VK.common;static view="singleDefault";type=VK.common}class G1 extends GK{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([M0]);class Y1 extends G1{static type=VK.funnel;static view="singleDefault";type=VK.funnel;seriesType=NK.funnel}dK.useSeries([T0]);class X1 extends G1{static type=VK.funnel3d;static view="singleDefault";type=VK.funnel3d;seriesType=NK.funnel3d}const $1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function K1(t){let e=0;return C(t,"tick.visible")&&(e+=C(t,"tick.tickSize")),C(t,"label.visible")&&(e+=C(t,"label.space")),e}function q1(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function Z1(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function J1(t){const e=t?.orient;return"angle"===e||"radius"===e}const Q1=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},T$(t)?r:a)},t2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class e2 extends GK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=N(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return c(i)&&e.forEach((t=>{h(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],c(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class i2 extends e2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),h(n.angle.type)&&(n.angle.type="linear"),h(n.radius.type)&&(n.radius.type="band");const s=q1(n.angle,{min:0,max:1});h(n.angle.min)&&(n.angle.min=s.min),h(n.angle.max)&&(n.angle.max=s.max)}}dK.useSeries([D1,L1]);class n2 extends i2{static type=VK.gauge;static view="singleDefault";type=VK.gauge;seriesType=NK.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:NK.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===NK.gauge||t.type===NK.circularProgress));h(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&h(e.radiusField)&&h(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===NK.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),h(e.angle.type)&&(e.angle.type="linear"),h(e.radius.type)&&(e.radius.type="linear")}}dK.useSeries([z1]);class s2 extends YK{static type=VK.heatmap;static view="singleDefault";type=VK.heatmap;seriesType=NK.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class r2 extends YK{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}dK.useSeries([zZ]);class a2 extends r2{static type=VK.histogram;static view="singleDefault";type=VK.histogram;seriesType=NK.bar;transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([eJ]);class o2 extends r2{static type=VK.histogram3d;static view="singleDefault";type=VK.histogram3d;seriesType=NK.bar3d}dK.useSeries([QZ]);class l2 extends YK{static type=VK.line;static view="singleDefault";type=VK.line;seriesType=NK.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([CJ]);class h2 extends GK{static type=VK.map;static view="singleDefault";type=VK.map;seriesType=NK.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area}}isValidSeries(t){return t===NK.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class c2 extends e2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}dK.useSeries([OJ]);class d2 extends c2{static type=VK.pie;static view="singleDefault";type=VK.pie;seriesType=NK.pie}dK.useSeries([zJ]);class u2 extends c2{static type=VK.pie3d;static view="singleDefault";type=VK.pie3d;seriesType=NK.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}dK.useSeries([iQ]);class p2 extends i2{static type=VK.circularProgress;static view="singleDefault";type=VK.circularProgress;seriesType=NK.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}dK.useSeries([sQ]);class g2 extends YK{static type=VK.linearProgress;static view="singleDefault";type=VK.linearProgress;seriesType=NK.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="band"),h(e.type)&&(e.type="linear");const n=q1(e,{min:0,max:1});h(e.min)&&(e.min=n.min),h(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="linear"),h(e.type)&&(e.type="band");const n=q1(i,{min:0,max:1});h(i.min)&&(i.min=n.min),h(i.max)&&(i.max=n.max)}}}class f2 extends e2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}dK.useSeries([XJ]);class m2 extends f2{static type=VK.radar;static view="singleDefault";type=VK.radar;seriesType=NK.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:L({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}dK.useSeries([hJ]);class y2 extends YK{static type=VK.rangeArea;static view="singleDefault";type=VK.rangeArea;seriesType=NK.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===Wh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([sJ]);class _2 extends YK{static type=VK.rangeColumn;static view="singleDefault";type=VK.rangeColumn;seriesType=NK.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===Wh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([rJ]);class v2 extends YK{static type=VK.rangeColumn3d;static view="singleDefault";type=VK.rangeColumn3d;seriesType=NK.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===Wh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}dK.useSeries([YJ]);class b2 extends f2{static type=VK.rose;static view="singleDefault";type=VK.rose;seriesType=NK.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??AN,outerRadius:t.outerRadius??AN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}dK.useSeries([T1]);class x2 extends GK{static type=VK.sankey;static view="singleDefault";type=VK.sankey;seriesType=NK.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([UJ]);class S2 extends YK{static type=VK.scatter;static view="singleDefault";type=VK.scatter;seriesType=NK.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}dK.useSeries([ZJ,QJ]);class w2 extends GK{static type=VK.sequence;static view="singleDefault";type=VK.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==NK.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[NK.bar,NK.line,NK.area,NK.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===NK.dot?"band":"linear",visible:t.type!==NK.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===NK.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===NK.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=eK(t.data,this._dataSet,this._spec.data),t.type===NK.link&&(t.dataDot=eK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===NK.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===NK.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=b$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}dK.useSeries([u1]);class A2 extends GK{static type=VK.sunburst;static view="singleDefault";type=VK.sunburst;seriesType=NK.sunburst;getDefaultSeriesSpec(t){const e=c(t.startAngle)?t.startAngle:SN,i=c(t.endAngle)?t.endAngle:e+Gt(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=NK.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([I1]);class k2 extends GK{static type=VK.treemap;static view="singleDefault";type=VK.treemap;seriesType=NK.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([jZ]);class M2 extends j1{static type=VK.waterfall;static view="singleDefault";type=VK.waterfall;seriesType=NK.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&N(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),XK(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class C2 extends GK{type=VK.wordCloud;seriesType=NK.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([l0]);class T2 extends C2{static type=VK.wordCloud;static view="singleDefault";type=VK.wordCloud;seriesType=NK.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}dK.useSeries([h0]);class E2 extends C2{static type=VK.wordCloud3d;static view="singleDefault";type=VK.wordCloud3d;seriesType=NK.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class P2{plugins;id=tl();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Go("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this.plugins.find((e=>e.id===t))}getAll(){return this.plugins.slice()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function R2(t){const e={...t};return M(t.style)||(e.textStyle=_$(t.style)),M(t.textStyle)||L(e.textStyle,_$(t.textStyle)),t.shape?.style&&_$(e.shape.style),t.background?.style&&_$(e.background.style),e}function B2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class I2 extends xK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new P2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new TK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case dn.cartesianBandAxis:return Q1(R$(i),"band",e);case dn.cartesianLinearAxis:return Q1(R$(i),"linear",e);case dn.cartesianAxis:case dn.cartesianTimeAxis:return Q1(R$(i),void 0,e);case dn.polarBandAxis:return t2(i.orient,"band",e);case dn.polarLinearAxis:return t2(i.orient,"linear",e);case dn.polarAxis:return t2(i.orient,void 0,e);case dn.cartesianCrosshair:case dn.polarCrosshair:return e.component?.crosshair;case dn.colorLegend:return e.component?.colorLegend[B2(i)];case dn.sizeLegend:return e.component?.sizeLegend[B2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),m(this._originalSpec)?this._spec=this._originalSpec.map((t=>L({},this._theme,t))):this._spec=L({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:BX.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const D2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(h(a)||h(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},L2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{h(i[e])||t.latestData.forEach((t=>{N(i[e]).forEach((i=>{h(t[i])||(h(o[t[i]])&&(o[t[i]]=0),h(n[e])||(o[t[i]]+=parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class O2 extends I2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else Dl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Dl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=R$(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?Wh.horizontal:Wh.vertical)===Wh.horizontal,c(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(c(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):c(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),h(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Fl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(c(t)&&(c(t.userId)&&(this._seriesUserId=N(t.userId)),c(t.specIndex)&&(this._seriesIndex=N(t.specIndex))),c(this._spec.seriesId)){const t=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(c(this._spec.seriesIndex)){const t=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(c(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(c(this._spec.regionId)){const t=N(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(Fl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];let n=!1;if(this._relatedAxisComponent){const s={};Dl(this._regions,(r=>{const a="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,o="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!a||!o)return;const l=a.getAxisId()===this._relatedAxisComponent.id?a:o.getAxisId()===this._relatedAxisComponent.id?o:this._isHorizontal?a:o,h=l===a?o:a,c=Fl(h.getScale(0).type);c&&(n=!0),t.push(r.getRawData());const d=r.getSpec(),u=N(d.xField),p=N(d.yField),g="cartesian"===r.coordinate?u[u.length-1]:d.angleField??d.categoryField,f="cartesian"===r.coordinate?p[p.length-1]:d.radiusField??d.valueField;if(s[r.id]="link"===r.type?"from_xField":l===a?g:f,e.push(s[r.id]),this._valueField){const t="link"===r.type?"from_yField":h===a?g:f;i.push(c?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else n=h(this._spec.valueField),Dl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;$$(s,"dataview",Oo),X$(s,"dataFilterComputeDomain",L2);const r=new No(s);r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:n?this._valueField:null}}},!1),this._data=new DK(this._option,r),r.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&Fl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&Fl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Fl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new rh,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(X$(this._option.dataSet,"dataFilterWithNewDomain",D2),Dl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>Fl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Fl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ct(this._start-s,0,1),a=ct(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}j(O2,B1);class F2 extends O2{static type=dn.scrollBar;type=dn.scrollBar;name=dn.scrollBar;layoutZIndex=$X.DataZoom;layoutLevel=KX.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(h(i))return;if(!m(i))return new F2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new F2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new ZW({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(RX.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return h(i)||(n.padding=i),M(t?.style)||(n.railStyle=_$(t.style)),M(e?.style)||(n.sliderStyle=_$(e.style)),n}}class z2 extends O2{static type=dn.dataZoom;type=dn.dataZoom;name=dn.dataZoom;layoutZIndex=$X.DataZoom;layoutLevel=KX.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(h(i))return;if(!m(i))return new z2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new z2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize)}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new yh;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._stateScale:this._valueScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().x+e};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?this._valueScale:this._stateScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().y+e};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new gG({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(RX.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:_$(this._spec.background?.style),startHandlerStyle:_$(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:_$(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:_$(this._spec.middleHandler.background?.style)}},endHandlerStyle:_$(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:_$(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:_$(this._spec.endText?.style)},selectedBackgroundStyle:_$(this._spec.selectedBackground.style),dragMaskStyle:_$(this._spec.dragMask?.style),backgroundChartStyle:{line:L(_$(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,..._$(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:L(_$(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,..._$(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class H2 extends I2{static type=dn.customMark;type=dn.customMark;layoutType="absolute";layoutZIndex=$X.CustomMark;layoutLevel=KX.CustomMark;static createComponent(t,e){return t.customMark?[new H2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${$j}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${$j}_${n}`});if(s&&(h(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),c(t.dataId)||b(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class j2 extends I2{layoutType="absolute";static type=dn.brush;type=dn.brush;name=dn.brush;layoutZIndex=$X.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!h(i)&&!1!==i.visible)return[new j2(i,{...e,specKey:j2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new dY({zIndex:this.layoutZIndex,brushStyle:_$(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=RX.brushChange;r="brushStart"===n||"brushDown"===n?RX.brushStart:"brushEnd"===n||"brushMaskUp"===n?RX.brushEnd:RX.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{..._$(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&De(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&Ie(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){c(this._spec.regionId)&&c(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){c(this._spec.brushLinkSeriesId)&&c(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&N(t).includes(s.userId)||e&&N(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var N2;function V2(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function W2(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function U2(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:W2(t.rect),anchorCandidates:q2(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>V2(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;tV2(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function G2(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=Re(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=$2(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=ln(r,n,i);if(!$2(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],Y2(X2(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=Y2(X2(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=K2(t.rect,a,0),t}));return U2(h)}function Y2(t){return t>180?t-360:t}function X2(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function $2(t,e){for(let i=0;i{const{x:r,y:a}=K2({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(N2||(N2={}));class Z2 extends I2{static type=dn.mapLabel;type=dn.mapLabel;name=dn.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=$X.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!c(i.series)?new Z2(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new No(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new DK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new MG({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=Kh(this._spec.background?.padding),d=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const u={},p=this.dataToPosition(t),g=rB({});if(g.name=`${this.name}_marker_itemContainer_${e}`,u.container=g,this._spec.background?.visible){const t=lB(_$({...this._spec.background.style}));t.setAttributes(p),u.labelBackground=t,g.appendChild(t)}if(this._spec.icon?.visible){const t=dB(_$({...this._spec.icon.style}));t.setAttributes(p),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;u.icon=t,g.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=cB(_$({...this._spec.nameLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.nameLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&c(t[this.valueField])){const e=cB(_$({...this._spec.valueLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.valueLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}const f=Object.values(u).find((t=>!!t&&"group"!==t.type)),m={x:f?.getComputedAttribute("x"),y:f?.getComputedAttribute("y")},y={x:m.x,y:m.y,width:0,height:0};y.width=n+r+(i-1)*d,y.height=s+a;const _={rect:y,point:m,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));_.rect=K2(y,o,l),_.anchors=t,_.offset=l}else _.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:_,contentMarks:u}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:_$({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):U2(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class J2{id;name;service;static Name;constructor(t=J2.Name){this.id=tl(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function Q2(t,e){const i=e.getSpec?.();M(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=T$(e.layoutOrient),r=t[0],a=V(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);Q2(n?n.getChildren():[],t.component),Q2(s?s.getChildren():[],t.component)}}function e3(t){return 2===t.length&&b(t[0])&&b(t[1])&&t[1]>=t[0]}function i3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!b(a.min),extendable_max:!b(a.max)}}function n3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function s3(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function r3(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function a3(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const o3=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),l3=(t,e,i=0)=>{const n=new Wt(t).expand(i/2),s=new Wt(e).expand(i/2);return n.intersects(s)},h3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function d3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=xl(-90));const u=h$(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Wt).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},p3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return o3(p,r.options)};class g3 extends J2{Name="AxisSyncPlugin";constructor(){super(g3.Name)}_checkEnableSync(t){if(!Fl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(RX.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!Fl(i.type)||!Fl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!e3(s)||!e3(r))return;const a=i3(t,s),o=i3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!s3(a,o))return}else if(0===p&&0===g){if(!s3(o,a))return}else if(u||y)if(u&&!y){if(!n3(a,o))return}else if(y&&!u){if(!n3(o,a))return}else{if(h===g)return;if(h>g){if(!r3(a,o))return}else if(!r3(o,a))return}else{if(0===h&&0===p){if(!a3(a,o))return}else if(0===g&&0===l&&!a3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){X$(e.getOption().dataSet,"tickAlign",p3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var f3={AxisLabelOverlapPlugin:t3,AxisSyncPlugin:g3};const m3=t=>t,y3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!c3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},_3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?h3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return o3(t.domain());let h;if(c(s))h=t.stepTicks(s);else if(c(n))h=t.forceTicks(n);else if(c(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=K1(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=K1(r),c=h$(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Rl(u),{x:m,y:y}=$t({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Wt).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=b3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}else h=t.domain();return o3(h)},b3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&l3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},x3=(t,e)=>{if(Fl(t.type))return((t,e)=>{if(!Fl(t.type))return o3(t.domain());const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=c(s)?t.stepTicks(s):c(n)?t.forceTicks(n):t.ticks(i??5),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=u3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&d3(s,i);)s=y3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),V(a)!==V(r)&&a.push(V(r))),r=a}return o3(r)})(t,e);if(Hl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(c(s))l=t.stepTicks(s);else if(c(n))l=t.forceTicks(n);else if(c(i))l=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=u3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=_3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}else l=t.domain();return o3(l)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return v3(t,e)}return o3(t.domain())};class S3 extends I2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),c(this._spec.id)&&t.setUserId(this._spec.id),o(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==C(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=PZ(TZ.axis(),{appear:this._spec.animationAppear??C(this._option.getChart().getSpec(),"animationAppear.axis")??C(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??C(this._option.getChart().getSpec(),"animationDisappear.axis")??C(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??C(this._option.getChart().getSpec(),"animationEnter.axis")??C(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??C(this._option.getChart().getSpec(),"animationExit.axis")??C(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??C(this._option.getChart().getSpec(),"animationUpdate.axis")??C(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return Dl(this._regions,(e=>{m(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;c(t)&&(this._seriesUserId=N(t)),c(i)&&(this._regionUserId=N(i)),c(e)&&(this._seriesIndex=N(e)),c(n)&&(this._regionIndex=N(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(Dl(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!Fl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(Dl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===$U.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&h(t.title.angle)&&(i="left"===t.orient?-90:90,e=$1[t.orient]),{orient:this.orient,select:t.select,hover:t.hover,line:(n=t.domainLine,m$(n),m$(n.startSymbol),m$(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:l(t.label.style)?(e,i)=>{const n=this._preprocessSpec(t.label.style(e.rawValue,i,e));return _$(this._preprocessSpec(L({},this._theme.label?.style,n)))}:_$(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:y$(t.label.state),autoRotate:!!t.label.autoRotate,autoHide:!!t.label.autoHide,autoLimit:!!t.label.autoLimit,autoRotateAngle:t.label.autoRotateAngle,autoHideMethod:t.label.autoHideMethod,autoHideSeparation:t.label.autoHideSeparation,limitEllipsis:t.label.limitEllipsis,layoutFunc:t.label.layoutFunc},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:l(t.tick.style)?(e,i)=>{const n=this._preprocessSpec(t.tick.style(e.rawValue,i,e));return _$(this._preprocessSpec(L({},this._theme.tick?.style,n)))}:_$(t.tick.style),state:y$(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:_$(t.subTick.style),state:y$(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:l(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return _$(this._preprocessSpec(L({},this._theme.grid?.style,n)))}:_$(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:_$(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Ut(i):null,textStyle:L({},e,_$(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:_$(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:_$(t.title.background?.style)},state:{text:y$(t.title.state),shape:y$(t.title.shape?.state),background:y$(t.title.background?.state)}},panel:{visible:t.background?.visible,style:_$(t.background?.style),state:y$(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const w3=[f3.AxisLabelOverlapPlugin,f3.AxisSyncPlugin];class A3 extends S3{static type=dn.cartesianAxis;type=dn.cartesianAxis;name=dn.cartesianAxis;layoutType="region-relative";layoutZIndex=$X.Axis;layoutLevel=KX.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;_verticalLimitSize;constructor(t,e){super(t,{...e}),this._orient=R$(t,["z"]),P$(this._orient)&&(this.layoutType="absolute"),c(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?T$(t)?"linear":"band":T$(t)?"band":"linear"}(t.orient,i),s=`${A3.type}-${n}`,r=b$.getComponentInKey(s);if(r){let n=t.inverse;return i&&!T$(t.orient)&&(n=!c(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(A3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[A3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===Wh.horizontal;if(!m(i))return Z1(i)?A3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>E$(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{Z1(t)&&a.push(A3.createAxis(t,{...e,specIndex:i,specKey:A3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),Dl(this._regions,(t=>{T$(this.orient)?t.setXAxisHelper(this.axisHelper()):E$(this.orient)?t.setYAxisHelper(this.axisHelper()):P$(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];T$(this.orient)?b(e)&&(s=n?[e,0]:[0,e]):P$(this.orient)?b(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):b(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(w3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();T$(this.orient)?h(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):h(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=T$(this.orient)?t.fieldX:P$(this.orient)?t.fieldZ:t.fieldY,Fl(this._scale.type)?e:[e[0]]}_initData(){$$(this._option.dataSet,"scale",m3),X$(this._option.dataSet,"ticks",x3);const t=this._spec.label||{},e=this._tick||{},i=new No(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new DK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(lV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(T$(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(RX.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Dl(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return Dl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:T$(this.orient)?i.fieldX:P$(this.orient)?i.fieldZ:i.fieldY,n=m(n)?Fl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Dl(this._regions,(t=>{T$(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):E$(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):P$(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;b(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),b(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=T$(this.orient)?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=T$(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(L({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=L({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&h(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=T$(this.orient),s=t=>(n?!T$(t.orient):T$(t.orient))&&Fl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(c(t))a=r.find((e=>e.id===t));else if(c(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const k3=Math.sqrt(50),M3=Math.sqrt(10),C3=Math.sqrt(2);class T3{_extend={};setExtraAttrFromSpec(){c(this._spec.nice)&&(this._nice=this._spec.nice),c(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=q1(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];c(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),c(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(W(t)-function(t){if(t&&m(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=k3?10:s>=M3?5:s>=C3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(RX.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}j(R3,P3);class B3 extends E3{static type=dn.cartesianTimeAxis;type=dn.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),Dl(this._regions,(t=>{T$(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=L({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new No(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new DK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=Vo.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return m(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&m(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class I3 extends S3{static type=dn.polarAxis;type=dn.polarAxis;name=dn.polarAxis;layoutType="absolute";layoutZIndex=$X.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=bN;get startAngle(){return this._startAngle}_endAngle=xN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${I3.type}-${i}`,s=b$.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(I3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!m(i))return J1(i)?(i.center=t.center,i.startAngle=t.startAngle??SN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:wN),I3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!J1(i))return;i.center=t.center,i.startAngle=t.startAngle??SN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:wN),i.outerRadius=i.radius??t.outerRadius??t.radius??AN;const o=I3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),Dl(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=xl(this._spec.startAngle??SN),this._endAngle=xl(this._spec.endAngle??(c(this._spec.startAngle)?this._spec.startAngle+360:wN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(RX.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){$$(this._option.dataSet,"scale",m3),X$(this._option.dataSet,"ticks",x3);const t=this._spec.label||{},e=this._spec.tick||{},i=new No(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new DK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return Dl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=m(n)?Fl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Dl(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return Fl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=wl({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=jt.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=AN,e=0;const i=this.getChart().getSpec();return Dl(this.getRegions(),(n=>{const s=n;if(function(t){return[NK.rose,NK.radar,NK.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;b(n)&&(t=n),b(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(L({},this._axisStyle,t))}}class D3 extends I3{static type=dn.polarLinearAxis;type=dn.polarLinearAxis;_zero=!0;_nice=!0;_scale=new yh;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}j(D3,T3);class L3 extends I3{static type=dn.polarBandAxis;type=dn.polarBandAxis;_scale=new rh;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function O3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:p,regionId:g,regionIndex:f,seriesIndex:m,seriesId:y,padding:_,...v}=L({},t),b=v;return i.visible&&(b.title=R2(i)),M(n.focusIconStyle)||_$(n.focusIconStyle),m$(n.shape),m$(n.label),m$(n.value),m$(n.background),Yh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),Yh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),Yh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),b.item=n,M(s.textStyle)||_$(s.textStyle),m$(s.handler),b.pager=s,r.visible&&!M(r.style)&&(L(b,r.style),c(r.padding)&&(b.padding=r.padding)),b}j(L3,P3);const F3=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},z3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return c(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class H3 extends I2{layoutType="normal";layoutZIndex=$X.Legend;layoutLevel=KX.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{Dl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Dl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Uh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;c(i)&&(this._seriesUserId=N(i)),c(t)&&(this._regionUserId=N(t)),c(n)&&(this._seriesIndex=N(n)),c(e)&&(this._regionUserIndex=N(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new DK(this._option,t),this._initSelectedData(),Dl(this._regions,(t=>{t.event.on(RX.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;h(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(RX.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;b(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(L({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(L({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class j3 extends H3{static type=dn.discreteLegend;type=dn.discreteLegend;name=dn.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return i.type&&"discrete"!==i.type?void 0:new j3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new j3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),Dl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){X$(this._option.dataSet,"discreteLegendFilter",z3),X$(this._option.dataSet,"discreteLegendDataMake",F3);const t=new No(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!il(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=p$(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...O3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return zG}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(IG.legendItemClick,(e=>{const i=C(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(RX.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(IG.legendItemHover,(t=>{const e=C(t,"detail");this.event.emit(RX.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(IG.legendItemUnHover,(t=>{const e=C(t,"detail");this.event.emit(RX.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:b(r)?r:1,strokeOpacity:b(a)?a:1,opacity:b(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return l(this._spec.data)?this._spec.data(t):t}}const N3=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;b(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},V3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!M(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function W3(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:d,id:u,visible:p,orient:g,position:f,data:m,defaultSelected:y,field:_,filter:v,regionId:b,regionIndex:x,seriesIndex:S,seriesId:w,padding:A,...k}=L({},t),C=k;return e.visible&&(C.title=R2(e)),C.showHandler=!1!==i.visible,M(i.style)||(C.handlerStyle=_$(i.style)),c(n.width)&&(C.railWidth=n.width),c(n.height)&&(C.railHeight=n.height),M(n.style)||(C.railStyle=_$(n.style)),M(s.style)||(C.trackStyle=_$(s.style)),C.startText=m$(r),C.endText=m$(a),C.handlerText=m$(o),M(l)||(C.sizeBackground=_$(l)),h.visible&&!M(h.style)&&(L(C,h.style),c(h.padding)&&(C.padding=h.padding)),C}function U3(t){return"color"===t||"size"===t}const G3={color:WG,size:GG},Y3=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],X3=[2,10];class $3 extends H3{static type=dn.continuousLegend;type=dn.colorLegend;name=dn.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return U3(i.type)?new $3(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{U3(t.type)&&n.push(new $3(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?dn.colorLegend:dn.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),Dl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){X$(this._option.dataSet,"continuousLegendFilter",V3),X$(this._option.dataSet,"continuousLegendDataMake",N3);const t=new No(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=p$(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!il(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=p$(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),M(n)&&(n="color"===this._legendType?Y3:X3);const r={...W3(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return G3[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",gt((e=>{const i=C(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(RX.legendFilter,{model:this,value:i,event:e})}),30))}}}const K3=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),N(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class q3 extends I2{static type=dn.indicator;type=dn.indicator;name=dn.indicator;layoutType="absolute";layoutZIndex=$X.Indicator;layoutLevel=KX.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==q3.type)return null;const i=N(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map((t=>new q3(t,e)));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){X$(this._option.dataSet,"indicatorFilter",K3);const t=new No(this._option.dataSet);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 DK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return N(this._spec.content).forEach((t=>{const e=L({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{..._$(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!c(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{..._$(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new $G(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":l(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return Dl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){super.clear(),this._indicatorComponent=null,this._cacheAttrs=null}}class Z3 extends I2{static type=dn.title;type=dn.title;layoutType="normal";layoutZIndex=$X.Title;layoutLevel=KX.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Uh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!m(i))return new Z3(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new Z3(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;b(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),b(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:b(t.width())?t.width():0,height:this._spec.height?this._spec.height:b(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new YG(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class J3{projection;constructor(t){if(this.projection=uJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function Q3(t,e){return`${$j}_${e}_${t}`}class t5 extends I2{static type=dn.geoCoordinate;type=dn.geoCoordinate;name=dn.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:Q3(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(h(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new t5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=L(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(RX.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new J3(this._projectionSpec)}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===NK.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===NK.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(NK.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==NK.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}j(t5,B1);const e5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},i5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class n5 extends I2{layoutType="absolute";gridZIndex=$X.CrossHair_Grid;labelZIndex=$X.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach(((t,i)=>this._registerEvent(t,m(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:BX.chart},this._handleEvent),this.event.on(e,{level:IX.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ft((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(e5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(m(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(e5[e][t]),s=s.concat(e5[e][i(t)])})),{in:n,out:s}}return{in:e5[e][t],out:e5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=C(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{i5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),m(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function r5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var a5,o5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(a5||(a5={}));class l5 extends n5{static type=dn.cartesianCrosshair;type=dn.cartesianCrosshair;name=dn.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.xField||i.yField?new l5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new l5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,a5.VERTICAL,!0),this.layoutByValue(a5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,a5.HORIZONTAL,!1),this.layoutByValue(a5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return Fl(t.getScale().type)&&b(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){T$(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{Hl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(a5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=a5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,d;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(Hl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(Fl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=r5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=K1(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(Hl(s.type)){const t=s._step;d=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(Fl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=r5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(d=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):d=1,a=r}}if(this.yHair.label?.visible){const e=K1(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(a5.HORIZONTAL&&this._layoutHorizontal(n,d??0),a5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new _U({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new vU({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new mU(e)),n.add(t)),s5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(o5||(o5={}));class h5 extends n5{static type=dn.polarCrosshair;type=dn.polarCrosshair;name=dn.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.categoryField||i.valueField?new h5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new h5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{Hl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});Fl(s.getScale().type)&&b(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:jt.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(o5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",L(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=K1(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=K1(t.getSpec())),n.angle=i.angle,n.axis=t,L(n,s)}))),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(o5.HORIZONTAL&&this._layoutHorizontal(n),o5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:$t(l,n,i),end:$t(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new _U({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new xU({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Rl(i),e={...$t(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Kt(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=$t(t,s,p),m=$t(t,s,g),y=ve([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=ct(jt.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new SU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new bU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=bl(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}}(i),n={...$t(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new mU(e),n.add(t),i(t)),s5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const c5=t=>_$({...t}),d5=t=>({...t,style:{..._$(t.style)}}),u5=t=>{const e=c5(t?.slider?.trackStyle??{}),i=c5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},_$({...s}));var s;const r=d5(t?.controller?.start??{}),a=d5(t?.controller?.pause??{}),o=d5(t?.controller?.backward??{}),l=d5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},p5=(t,e)=>({...u5(t),data:e,type:"continuous"}),g5=(t,e)=>({...u5(t),data:e,type:"discrete"}),f5=t=>"left"===t||"right"===t,m5=t=>"top"===t||"bottom"===t;class y5 extends I2{layoutZIndex=$X.Player;layoutLevel=KX.Player;static type=dn.player;type=dn.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return h(i)||!1===i.visible?null:new y5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),b(t.x)){const e=f5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(b(t.y)){const e=m5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(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}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{...g5(this._spec,this._specs),...e}:{...p5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new oY(t):this._playerComponent=new hY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 v(this._spec.width)?Math.min(t.width,Number(this._spec.width)):f5(this._orient)?this._maxSize():t.width}_computeHeight(t){return v(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):m5(this._orient)?this._maxSize():t.height}_computeDx(t){return f5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return m5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size),(f5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(f5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(RX.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(iY.OnEnd,(()=>{this.event.emit(RX.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(iY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];N(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(RX.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const _5=(t,e)=>Cl(t[0].latestData,e.field),v5=(t,e)=>Tl(t[0].latestData,e.field);function b5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function x5(t,e){return El(t[0].latestData,e.field)}function S5(t,e){return Pl(t[0].latestData,e.field)}function w5(t,e){return function(t,e){return Math.sqrt(Pl(t,e))}(t[0].latestData,e.field)}function A5(t,e){return function(t,e){return Z(t.map((t=>t[e])))}(t[0].latestData,e.field)}function k5(t,e){const i={min:_5,max:v5,sum:b5,average:x5,variance:S5,standardDeviation:w5,median:A5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(c(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(c(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function M5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.x)){v(t.x)&&E5(u,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function C5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.y)){v(t.y)&&E5(u,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function T5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();v(t.x)&&E5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),v(t.y)&&E5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function E5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const P5=["sum","average","min","max","variance","standardDeviation","median"];class R5 extends I2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||P5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??N(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(N(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Cl(t,e),r=Tl(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class I5 extends R5{static type=dn.markLine;type=dn.markLine;name=dn.markLine;layoutZIndex=$X.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new I5(i,{...e,specKey:I5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new I5(t,{...e,specIndex:i,specKey:I5.speckey}))})),n}_createMarkerComponent(){const t=new AG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:_$(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:_$(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:_$(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{..._$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{..._$(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:_$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)||c(t.coordinates)&&c(t.process)&&c(t.process.x),a=c(t.y)||c(t.coordinates)&&c(t.process)&&c(t.process.y),o=c(t.coordinates)&&(!c(t.process)||"process"in t&&"xy"in t.process),l=c(t.positions),h=t?.autoRange??!1;let d=[];r?d=M5(e,i,n,s,h)[0]:a?d=C5(e,i,n,s,h)[0]:o?d=T5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;X$(this._option.dataSet,"markerAggregation",k5),X$(this._option.dataSet,"markerRegression",B5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new No(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new No(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class D5 extends R5{static type=dn.markArea;type=dn.markArea;name=dn.markArea;layoutZIndex=$X.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new D5(i,{...e,specKey:D5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new D5(t,{...e,specIndex:i,specKey:D5.speckey}))})),n}_createMarkerComponent(){const t=new kG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:_$(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{..._$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{..._$(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:_$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)&&c(t.x1),a=c(t.y)&&c(t.y1),o=c(t.coordinates),l=c(t.positions),h=t?.autoRange??!1;let d=[],u=[];r?(u=M5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):a?(u=C5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):o?d=T5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=c(t.x)&&c(t.x1),n=c(t.y)&&c(t.y1),s=c(t.coordinates);if(!i&&!n&&!s)return null;let r;X$(this._option.dataSet,"markerAggregation",k5),X$(this._option.dataSet,"markerRegression",B5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new No(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class L5 extends R5{static type=dn.markPoint;type=dn.markPoint;name=dn.markPoint;layoutZIndex=$X.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new L5(i,{...e,specKey:L5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new L5(t,{...e,specIndex:i,specKey:L5.speckey}))})),n}_createMarkerComponent(){const t=new MG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:_$(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:_$(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{..._$(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{..._$(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:_$(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=T5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!c(t.coordinate))return;X$(this._option.dataSet,"markerAggregation",k5);const i=this._processSpecCoo(t),n=new No(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const O5=(t,e,i)=>h(t)?t:l(t)?t(e,i):t,F5=(t,e,i)=>{if(h(t))return t;if(m(t)){const n=[];return t.forEach((t=>{if(l(t)){const s=t(e,i);c(s)&&n.push(s)}else n.push(t)})),n}return l(t)?t(e,i):t};const z5=(t,e)=>(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight),H5="vchart-tooltip-container",j5=20,N5={key:"其他",value:"..."},V5={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class W5{static dom=`${$j}_TOOLTIP_HANDLER_DOM`;static canvas=`${$j}_TOOLTIP_HANDLER_CANVAS`}const U5=(t,e,i)=>{const n=O5(e.key,t,i),s=O5(e.value,t,i),r=!1!==O5(e.visible,t,i)&&(c(n)||c(s)),a=O5(e.isKeyAdaptive,t,i),o=O5(e.shapeType,t,i),l=O5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},G5=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,Y5=(t,e)=>{let i;if(c(t))if(v(t))i=t;else if(l(t)){const n=t(e);v(n)&&(i=n)}return i},X5=(t,e)=>{const i=h$(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function $5(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Tj,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var K5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(K5||(K5={}));class q5{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),K5.success):(this._updateTooltip(!1,e),K5.success)}if(h(n)||h(s))return K5.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(c(t.visible)||c(t.activeType)?s.visible=oq(t).includes("mark"):c(e.visible)||c(e.activeType)?s.visible=oq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=G5(i,"mark")??{},a=L({},R(e.mark),R(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(c))),[]);if(t.every((t=>!oq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:c(e.visible)||c(e.activeType)?s.visible=oq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=G5(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{l(t)?o.push(t):o.push(...N(t))})),r={...i[0],content:o};let d={};const u=t.filter((t=>{const e=t.tooltipHelper?.spec;return c(e?.dimension)&&oq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(u.length){let t=[];u.every((({content:t})=>h(t)))?t=void 0:u.forEach((({content:e})=>{h(e)||(l(e)?t?.push(e):t?.push(...N(e)))})),d={...u[0],content:t}}a=L({},R(e.dimension),d)}const o=r.title,d={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(c(a.title))if(l(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...d,...n}}}else a.title={...r.title,...d,...a.title};else a.title={...r.title,...d};const u=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),p=N(r.content);if(c(a.content))if(l(a.content)){const t=a.content;a.content=(e,i)=>{const n=N(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...u(p[0]),...t}})),n}}else{const t=N(a.content);t.forEach(((e,i)=>{t[i]={...u(p[0]),...e}}))}else a.content=p.map((t=>({...t,...u(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return K5.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??K5.success;const a=r[n];if(!a)return K5.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),h(o.title?.key)&&h(o.title?.value)&&!o.content?.length?K5.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??K5.success;const o=i[n];if(!o)return K5.failed;const l=this._getActualTooltipPosition(e,F5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),K5.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=v(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...V5,offsetX:t?.x??V5.offsetX,offsetY:t?.y??V5.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=F5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=F5(t.title,e,i),s=N(F5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=j5}=t,o=!1!==O5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,c(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=O5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=U5(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...N5});break}if(!(r.content.lengthh(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=U5(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...N5});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(h(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),h(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!c(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,u=this._component.getSpec(),p="canvas"===u.renderMode,g=i?.chart?.getCanvasRect(),f=g?.width??Kj,m=g?.height??qj;let y,_,v,x,S,w,A=!1;if(d(e)){const{left:t,right:i,top:n,bottom:s}=e;y=Y5(t,r),_=Y5(n,r),v=Y5(i,r),x=Y5(s,r)}else if(c(e)&&"mark"===t.activeType){A=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case C$.left:y=t-a-l,_=(i+c)/2-o/2;break;case C$.right:y=n+l,_=(i+c)/2-o/2;break;case C$.top:y=(t+n)/2-a/2,_=i-o-h;break;case C$.bottom:y=(t+n)/2-a/2,_=c+h;break;case C$.inside:y=(t+n)/2-a/2,_=(i+c)/2-o/2}}}const k={width:0,height:0},M=(t=0)=>({x:t,y:t});let C=M(),T=M(),E=1,P=1;if(qo(this._env)&&!u.confine){if(k.width=window.innerWidth,k.height=window.innerHeight,!p){T=n.getBoundingClientRect();const t=this._compiler.getCanvas()??this._chartContainer,e=t.getBoundingClientRect();C={x:e.x-T.x,y:e.y-T.y},E=z5(t,e),P=z5(n,T)}}else k.width=f,k.height=m;const{canvasX:R,canvasY:B}=r;S=b(y)?y:b(v)?f-a-v:R+l,w=b(_)?_:b(x)?m-o-x:B+h,S*=E,w*=E,qo(this._env)&&(S+=C.x,w+=C.y),S/=P,w/=P;const{width:I,height:D}=k;return(S+a)*P+T.x>I&&(A?S=(I-T.x)/P-a:S-=2*l+a),(w+o)*P+T.y>D&&(A?w=(D-T.y)/P-o:w-=2*h+o),S*P+T.x<0&&(S=0-T.x/P),w*P+T.y<0&&(w=0-T.y/P),{x:S,y:w}};_getTooltipBoxSize(t,e){return e&&!h(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:m="",hasShape:y,shapeType:_="",shapeHollow:v,shapeColor:b}=h;if(l.title.visible=f,f){const{text:t,width:e,height:i}=X5(m,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},u=e,g=i,y&&VP[_]){const t={symbolType:_};v?t.stroke=b:t.fill=b,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],h=[],d=[];l.content=t.map(((l,u)=>{const g={height:0,spaceRow:i};let f=0;const{hasShape:m,key:y,shapeColor:_,shapeHollow:v,shapeType:b="",value:x,isKeyAdaptive:S}=l;if(c(y)){const{width:t,height:e,text:i}=X5(y,a);g.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},S?h.push(t):n.push(t),f=Math.max(f,e)}if(c(x)){const{width:t,height:e,text:i}=X5(x,o);g.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},d.push(t),f=Math.max(f,e)}if(m&&VP[b]){e=!0;const t={visible:!0,symbolType:b};v?t.stroke=_:t.fill=_,f=Math.max(r.size,f),g.shape=t}else g.shape={visible:!1};return g.height=f,p+=f,uc(t)?m(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function J5(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=L({},e,t),d={};return d.fontFamily=i,d.fontSize=Z5(n),d.color=s,d.textAlign=r,d.lineHeight=Z5(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=Z5(c),d}function Q5(t,e){if(!t)return;const{size:i}=L({},e,t),n={};return n.width=Z5(i),n}class t4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===t4.type}type=t4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return t4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=Ko?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(t4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const e4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},i4={boxSizing:"border-box"},n4={display:"flex",whiteSpace:"nowrap"},s4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},r4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},a4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},o4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},l4={lineHeight:"normal"};class h4 extends t4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!VP[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=VP[e].pathStr;let o="currentColor";if(!n||f(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(d(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class c4 extends t4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class d4 extends t4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=$(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=$(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},s4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=L({},a?a4:r4,{height:Z5(i[n].height),...t.keyColumn.item});f(r)&&""!==r?.trim?.()||v(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=L({},o4,{height:Z5(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=L({},l4,{height:Z5(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class u4 extends t4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new d4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new d4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new d4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(L({},n4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class p4 extends t4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new h4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new c4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(L({},e4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class g4 extends t4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&c(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new p4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new u4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},i4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class f4 extends q5{type=W5.dom;_tooltipContainer=Ko?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(Ko&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:d,lineWidth:u=0},padding:p,key:g,value:f,title:m,shape:y,enterable:_,spaceRow:v,transitionDuration:b}=t,x=i,S={panel:{width:Z5((e?.panel?.width??0)+2*u),height:Z5((e?.panel?.height??0)+2*u),paddingBottom:Z5(p.bottom),paddingLeft:Z5(p.left),paddingRight:Z5(p.right),paddingTop:Z5(p.top),borderColor:d,borderWidth:Z5(u),borderRadius:Z5(h),backgroundColor:x?`${x}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:_?"auto":"none",transitionDuration:b?`${b}ms`:"initial",transitionProperty:b?"transform":"initial",transitionTimingFunction:b?"ease-out":"initial"},title:J5(m),content:{},shapeColumn:{item:Q5(y),width:Z5(y.size),marginRight:Z5(y.spacing??8)},keyColumn:{item:J5(g),width:Z5(e?.keyWidth),marginRight:Z5(g.spacing??26)},valueColumn:{item:J5(f),width:Z5(e?.valueWidth),marginRight:Z5(f.spacing??0)},spaceRow:Z5(v)};if(c(v)){const t=v/2;[S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((e=>{e.marginTop=Z5(t),e.marginBottom=e.marginTop})),S.content.marginTop=Z5(-t),S.content.marginBottom=S.content.marginTop}else[S.content,S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return S}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class m4 extends q5{type=W5.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new mY({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}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?c(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class y4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&c(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??K5.success:K5.failed}class _4 extends y4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![W5.dom,W5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!lq(t)&&!h(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...L$(r,a)??[],...H$(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(c(i))break}return c(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class v4 extends y4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![W5.dom,W5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const b4=t=>c(t)&&!m(t),x4=t=>c(t)&&m(t);class S4 extends I2{static type=dn.tooltip;type=dn.tooltip;name=dn.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!m(i))return new S4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new S4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?m4:f4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new v4(this),dimension:new _4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:IX.chart},this._handleMouseMove),(Zo(e)||Jo(e))&&(this._mountEvent("pointerdown",{level:IX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:IX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;qo(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||lq(t)||(n&&b4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&x4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):c(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!h(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&dK.globalConfig.uniqueTooltip&&dK.hideTooltip(a.id),r};_getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=L({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!c(t.visible)||t.visible,activeType:oq(t),renderMode:"html",trigger:c(t.trigger)?t.trigger:"hover",className:c(t.className)?t.className:"vchart-tooltip-element",enterable:!!c(t.enterable)&&t.enterable,transitionDuration:c(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=c(t.triggerOff)?t.triggerOff:this._spec.trigger,c(t.renderMode)?this._spec.renderMode=t.renderMode:Jo(this._option.mode)&&(this._spec.renderMode="canvas"),c(t.mark)&&(this._spec.mark={...R(t.mark),activeType:"mark"}),c(t.dimension)&&(this._spec.dimension={...R(t.dimension),activeType:"dimension"}),c(t.parentElement)?f(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:qo(this._option.mode)&&(this._spec.parentElement=Ko?.body),c(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=aq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:BX.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(h(this._cacheInfo)||h(t))return!1;if(x4(t)){if(b4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>S$(t,e[i])))}if(x4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(c(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(c(n)&&c(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function w4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function A4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const k4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??w4(e)};let o=!1;return f(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??A4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class M4 extends I2{static type=dn.label;type=dn.label;name=dn.label;layoutType="absolute";layoutZIndex=$X.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new M4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(RX.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(lV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(lV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Dl(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:v$.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:v$.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=k4[s.type]??k4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return L({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class C4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(b(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:l(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&c(t.modelId)){if(c(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&c(t.modelKey)&&"modelIndex"in t&&c(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>T4(t))),a=s.filter((t=>!T4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>T4(t))),h=o.filter((t=>!T4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);b(o.width)||(o.width=a.width),b(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function T4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class E4 extends PK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&T$(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&E$(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}dK.useChart([H1,l2,j1,N1,S2,h2,d2,u2,b2,m2,U1,w2,a2,o2,p2,T2,E2,Y1,X1,g2,_2,v2,A2,W1,k2,M2,V1,x2,n2,y2,s2]),dK.useComponent([E3,R3,B3,L3,D3,j3,$3,S4,l5,h5,z2,F2,q3,t5,I5,Z3,D5,y5,M4,L5,j2,H2,Z2]),b$.registerLayout("grid",C4),b$.registerLayout("layout3d",E4),t.Arc3dMark=FJ,t.ArcMark=DJ,t.AreaChart=H1,t.AreaMark=aJ,t.AreaSeries=oJ,t.Bar3dChart=N1,t.Bar3dSeries=eJ,t.BarChart=j1,t.BarSeries=zZ,t.BaseChart=GK,t.BaseMark=FK,t.BaseSeries=Sq,t.BoxPlotChart=V1,t.BoxPlotMark=GZ,t.BoxPlotSeries=$Z,t.Brush=j2,t.CartesianAxis=A3,t.CartesianBandAxis=R3,t.CartesianChart=YK,t.CartesianCrossHair=l5,t.CartesianLinearAxis=E3,t.CartesianSeries=wq,t.CartesianTimeAxis=B3,t.CellMark=F1,t.CirclePackingChart=W1,t.CirclePackingSeries=f1,t.CircularProgressChart=p2,t.CircularProgressSeries=iQ,t.CommonChart=U1,t.ComponentMark=HK,t.ContinuousLegend=$3,t.CustomMark=H2,t.DataZoom=z2,t.DiscreteLegend=j3,t.DotSeries=ZJ,t.Factory=b$,t.Funnel3dChart=X1,t.Funnel3dSeries=T0,t.FunnelChart=Y1,t.FunnelSeries=M0,t.GaugeChart=n2,t.GaugePointerSeries=D1,t.GaugeSeries=L1,t.GeoCoordinate=t5,t.GridLayout=C4,t.GroupMark=zK,t.HeatmapChart=s2,t.HeatmapSeries=z1,t.Histogram3dChart=o2,t.HistogramChart=a2,t.Indicator=q3,t.Label=M4,t.Layout=PK,t.Layout3d=E4,t.LineChart=l2,t.LineMark=JZ,t.LineSeries=QZ,t.LinearProgressChart=g2,t.LinearProgressSeries=sQ,t.LinkPathMark=C1,t.LinkSeries=QJ,t.MapChart=h2,t.MapLabelComponent=Z2,t.MapSeries=CJ,t.MarkArea=D5,t.MarkLine=I5,t.MarkPoint=L5,t.PathMark=wJ,t.Pie3dChart=u2,t.Pie3dSeries=zJ,t.PieChart=d2,t.PieSeries=OJ,t.Player=y5,t.PolarAxis=I3,t.PolarBandAxis=L3,t.PolarChart=e2,t.PolarCrossHair=h5,t.PolarLinearAxis=D3,t.PolarSeries=TJ,t.PolygonMark=k0,t.ProgressArcMark=eQ,t.ProgressLikeChart=i2,t.ProgressLikeSeries=tQ,t.Pyramid3dMark=C0,t.RadarChart=m2,t.RadarSeries=XJ,t.RangeAreaChart=y2,t.RangeAreaSeries=hJ,t.RangeColumn3dChart=v2,t.RangeColumn3dSeries=rJ,t.RangeColumnChart=_2,t.RangeColumnSeries=sJ,t.Rect3dMark=tJ,t.RectMark=OZ,t.RoseChart=b2,t.RoseLikeChart=f2,t.RoseLikeSeries=GJ,t.RoseSeries=YJ,t.RuleMark=HZ,t.SankeyChart=x2,t.SankeySeries=T1,t.ScatterChart=S2,t.ScatterSeries=UJ,t.ScrollBar=F2,t.SequenceChart=w2,t.SunburstChart=A2,t.SunburstSeries=u1,t.SymbolMark=XZ,t.TextMark=FZ,t.ThemeManager=l$,t.Title=Z3,t.Tooltip=S4,t.TreeMapChart=k2,t.TreeMapSeries=I1,t.VChart=dK,t.WaterfallChart=M2,t.WaterfallSeries=jZ,t.WordCloud3dChart=E2,t.WordCloud3dSeries=h0,t.WordCloudChart=T2,t.WordCloudSeries=l0,t.default=dK,t.version="1.1.0-beta.9",Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index 63438bbc16..3b5c8d84fa 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vchart", - "version": "1.1.0-beta.8", + "version": "1.1.0-beta.9", "description": "The react version of VChart 4.x", "keywords": [ "react", @@ -28,7 +28,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vchart": "workspace:1.1.0-beta.8", + "@visactor/vchart": "workspace:1.1.0-beta.9", "@visactor/vutils": "~0.13.3", "@visactor/vgrammar": "~0.4.1", "@visactor/vrender": "~0.13.2", diff --git a/packages/taro-vchart/package.json b/packages/taro-vchart/package.json index 2c985cace8..9b1a999156 100644 --- a/packages/taro-vchart/package.json +++ b/packages/taro-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/taro-vchart", - "version": "1.1.0-beta.8", + "version": "1.1.0-beta.9", "description": "Taro VChart 图表组件", "sideEffects": false, "main": "lib/src/index.js", @@ -40,7 +40,7 @@ }, "license": "MIT", "dependencies": { - "@visactor/vchart": "workspace:1.1.0-beta.8" + "@visactor/vchart": "workspace:1.1.0-beta.9" }, "devDependencies": { "@internal/eslint-config": "workspace:*", diff --git a/packages/tt-vchart/src/vchart/index.js b/packages/tt-vchart/src/vchart/index.js index c3527f7260..95d2b6d2e1 100644 --- a/packages/tt-vchart/src/vchart/index.js +++ b/packages/tt-vchart/src/vchart/index.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";const e=t=>t;var i,n;t.RenderModeEnum=void 0,(i=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",i["mobile-browser"]="mobile-browser",i.node="node",i.worker="worker",i.miniApp="miniApp",i["desktop-miniApp"]="desktop-miniApp",i.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.customMark="customMark"}(n||(n={}));for(let t=0;t<256;t++)t.toString(16);const s=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};class r{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let i=0;for(let n=0;n0){for(r=t[--s];s>0&&(e=r,i=t[--s],r=e+i,n=i-(r-e),!n););s>0&&(n<0&&t[s-1]<0||n>0&&t[s-1]>0)&&(i=2*n,e=r+i,i==e-r&&(r=e))}return r}}function a(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}var o=1e-6,l=1e-12,h=Math.PI,c=h/2,d=h/4,u=2*h,p=180/h,g=h/180,f=Math.abs,m=Math.atan,y=Math.atan2,_=Math.cos,v=Math.exp,b=Math.log,x=Math.pow,S=Math.sin,w=Math.sign||function(t){return t>0?1:t<0?-1:0},A=Math.sqrt,k=Math.tan;function M(t){return t>1?0:t<-1?h:Math.acos(t)}function C(t){return t>1?c:t<-1?-c:Math.asin(t)}function T(){}function E(t,e){t&&P.hasOwnProperty(t.type)&&P[t.type](t,e)}var R={Feature:function(t,e){E(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nh&&(t-=Math.round(t/u)*u),[t,e]}function U(t,e,i){return(t%=u)?e||i?V(Y(t),$(e,i)):Y(t):e||i?$(e,i):W}function G(t){return function(e,i){return f(e+=t)>h&&(e-=Math.round(e/u)*u),[e,i]}}function Y(t){var e=G(t);return e.invert=G(-t),e}function $(t,e){var i=_(t),n=S(t),s=_(e),r=S(e);function a(t,e){var a=_(e),o=_(t)*a,l=S(t)*a,h=S(e),c=h*i+o*n;return[y(l*s-c*r,o*i-h*n),C(c*s+l*r)]}return a.invert=function(t,e){var a=_(e),o=_(t)*a,l=S(t)*a,h=S(e),c=h*s-l*r;return[y(l*s+h*r,o*i+c*n),C(c*i-o*n)]},a}function X(t,e){(e=O(e))[0]-=t,N(e);var i=M(-e[1]);return((-e[2]<0?-i:i)+u-o)%u}function K(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:T,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function q(t,e){return f(t[0]-e[0])=0;--r)s.point((d=c[r])[0],d[1]);else n(p.x,p.p.x,-1,s);p=p.p}c=(p=p.o).z,g=!g}while(!p.v);s.lineEnd()}}}function Q(t){if(e=t.length){for(var e,i,n=0,s=t[0];++n=0?1:-1,H=F*L,j=H>h,V=M*I;if(f.add(y(V*F*S(H),T*D+V*_(H))),p+=j?L+F*u:L,j^A>=i^P>=i){var W=z(O(w),O(R));N(W);var U=z(a,W);N(U);var G=(j^L>=0?-1:1)*C(U[2]);(n>G||n===G&&(W[0]||W[1]))&&(g+=j^L>=0?1:-1)}}return(p<-o||p0){for(x||(s.polygonStart(),x=!0),s.lineStart(),t=0;t1&&2&r&&a.push(a.pop().concat(a.shift())),g.push(a.filter(nt))}return w}}function nt(t){return t.length>1}function st(t,e){return((t=t.x)[0]<0?t[1]-c-o:c-t[1])-((e=e.x)[0]<0?e[1]-c-o:c-e[1])}W.invert=W;var rt=it((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var l=r>0?h:-h,d=f(r-i);f(d-h)0?c:-c),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(r,n),e=0):s!==l&&d>=h&&(f(i-s)o?m((S(e)*(r=_(n))*S(i)-S(n)*(s=_(e))*S(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(l,n),e=0),t.point(i=r,n=a),s=l},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*c,n.point(-h,s),n.point(0,s),n.point(h,s),n.point(h,0),n.point(h,-s),n.point(0,-s),n.point(-h,-s),n.point(-h,0),n.point(-h,s);else if(f(t[0]-e[0])>o){var r=t[0]0,s=f(e)>o;function r(t,i){return _(t)*_(i)>e}function a(t,i,n){var s=[1,0,0],r=z(O(t),O(i)),a=F(r,r),l=r[0],c=a-l*l;if(!c)return!n&&t;var d=e*a/c,u=-e*l/c,p=z(s,r),g=j(s,d);H(g,j(r,u));var m=p,y=F(g,m),_=F(m,m),v=y*y-_*(F(g,g)-1);if(!(v<0)){var b=A(v),x=j(m,(-y-b)/_);if(H(x,g),x=L(x),!n)return x;var S,w=t[0],k=i[0],M=t[1],C=i[1];k0^x[1]<(f(x[0]-w)h^(w<=x[0]&&x[0]<=k)){var R=j(m,(-y+b)/_);return H(R,g),[x,L(R)]}}}function l(e,i){var s=n?t:h-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return it(r,(function(t){var e,i,o,c,d;return{lineStart:function(){c=o=!1,d=1},point:function(u,p){var g,f=[u,p],m=r(u,p),y=n?m?0:l(u,p):m?l(u+(u<0?h:-h),p):0;if(!e&&(c=o=m)&&t.lineStart(),m!==o&&(!(g=a(e,f))||q(e,g)||q(f,g))&&(f[2]=1),m!==o)d=0,m?(t.lineStart(),g=a(f,e),t.point(g[0],g[1])):(g=a(e,f),t.point(g[0],g[1],2),t.lineEnd()),e=g;else if(s&&e&&n^m){var _;y&i||!(_=a(f,e,!0))||(d=0,n?(t.lineStart(),t.point(_[0][0],_[0][1]),t.point(_[1][0],_[1][1]),t.lineEnd()):(t.point(_[1][0],_[1][1]),t.lineEnd(),t.lineStart(),t.point(_[0][0],_[0][1],3)))}!m||e&&q(e,f)||t.point(f[0],f[1]),e=f,o=m,i=y},lineEnd:function(){o&&t.lineEnd(),e=null},clean:function(){return d|(c&&o)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=_(e),o=S(e),l=n*i;null==s?(s=e+n*u,r=e-l/2):(s=X(a,s),r=X(a,r),(n>0?sr)&&(s+=n*u));for(var h,c=s;n>0?c>r:c0)do{o.point(0===h||3===h?t:i,h>1?n:e)}while((h=(h+a+4)%4)!==d);else o.point(r[0],r[1])}function l(n,s){return f(n[0]-t)0?0:3:f(n[0]-i)0?2:1:f(n[1]-e)0?1:0:s>0?3:2}function h(t,e){return c(t.x,e.x)}function c(t,e){var i=l(t,1),n=l(e,1);return i!==n?i-n:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(o){var l,c,d,u,p,g,f,m,y,_,v,b=o,x=K(),S={point:w,lineStart:function(){S.point=A,c&&c.push(d=[]);_=!0,y=!1,f=m=NaN},lineEnd:function(){l&&(A(u,p),g&&y&&x.rejoin(),l.push(x.result()));S.point=w,y&&b.lineEnd()},polygonStart:function(){b=x,l=[],c=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=c.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=v&&e,s=(l=a(l)).length;(i||s)&&(o.polygonStart(),i&&(o.lineStart(),r(null,null,1,o),o.lineEnd()),s&&J(l,h,e,r,o),o.polygonEnd());b=o,l=c=d=null}};function w(t,e){s(t,e)&&b.point(t,e)}function A(r,a){var o=s(r,a);if(c&&d.push([r,a]),_)u=r,p=a,g=o,_=!1,o&&(b.lineStart(),b.point(r,a));else if(o&&y)b.point(r,a);else{var l=[f=Math.max(lt,Math.min(ot,f)),m=Math.max(lt,Math.min(ot,m))],h=[r=Math.max(lt,Math.min(ot,r)),a=Math.max(lt,Math.min(ot,a))];!function(t,e,i,n,s,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=s-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,h,t,e,i,n)?o&&(b.lineStart(),b.point(r,a),v=!1):(y||(b.lineStart(),b.point(l[0],l[1])),b.point(h[0],h[1]),o||b.lineEnd(),v=!1)}f=r,m=a,y=o}return S}}var ct,dt,ut,pt,gt=t=>t,ft=new r,mt=new r,yt={point:T,lineStart:T,lineEnd:T,polygonStart:function(){yt.lineStart=_t,yt.lineEnd=xt},polygonEnd:function(){yt.lineStart=yt.lineEnd=yt.point=T,ft.add(f(mt)),mt=new r},result:function(){var t=ft/2;return ft=new r,t}};function _t(){yt.point=vt}function vt(t,e){yt.point=bt,ct=ut=t,dt=pt=e}function bt(t,e){mt.add(pt*t-ut*e),ut=t,pt=e}function xt(){bt(ct,dt)}var St=yt,wt=1/0,At=wt,kt=-wt,Mt=kt,Ct={point:function(t,e){tkt&&(kt=t);eMt&&(Mt=e)},lineStart:T,lineEnd:T,polygonStart:T,polygonEnd:T,result:function(){var t=[[wt,At],[kt,Mt]];return kt=Mt=-(At=wt=1/0),t}};var Tt,Et,Rt,Pt,Bt=Ct,It=0,Dt=0,Lt=0,Ot=0,Ft=0,zt=0,Ht=0,jt=0,Nt=0,Vt={point:Wt,lineStart:Ut,lineEnd:$t,polygonStart:function(){Vt.lineStart=Xt,Vt.lineEnd=Kt},polygonEnd:function(){Vt.point=Wt,Vt.lineStart=Ut,Vt.lineEnd=$t},result:function(){var t=Nt?[Ht/Nt,jt/Nt]:zt?[Ot/zt,Ft/zt]:Lt?[It/Lt,Dt/Lt]:[NaN,NaN];return It=Dt=Lt=Ot=Ft=zt=Ht=jt=Nt=0,t}};function Wt(t,e){It+=t,Dt+=e,++Lt}function Ut(){Vt.point=Gt}function Gt(t,e){Vt.point=Yt,Wt(Rt=t,Pt=e)}function Yt(t,e){var i=t-Rt,n=e-Pt,s=A(i*i+n*n);Ot+=s*(Rt+t)/2,Ft+=s*(Pt+e)/2,zt+=s,Wt(Rt=t,Pt=e)}function $t(){Vt.point=Wt}function Xt(){Vt.point=qt}function Kt(){Zt(Tt,Et)}function qt(t,e){Vt.point=Zt,Wt(Tt=Rt=t,Et=Pt=e)}function Zt(t,e){var i=t-Rt,n=e-Pt,s=A(i*i+n*n);Ot+=s*(Rt+t)/2,Ft+=s*(Pt+e)/2,zt+=s,Ht+=(s=Pt*t-Rt*e)*(Rt+t),jt+=s*(Pt+e),Nt+=3*s,Wt(Rt=t,Pt=e)}var Jt=Vt;function Qt(t){this._context=t}Qt.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,u)}},result:T};var te,ee,ie,ne,se,re=new r,ae={point:T,lineStart:function(){ae.point=oe},lineEnd:function(){te&&le(ee,ie),ae.point=T},polygonStart:function(){te=!0},polygonEnd:function(){te=null},result:function(){var t=+re;return re=new r,t}};function oe(t,e){ae.point=le,ee=ne=t,ie=se=e}function le(t,e){ne-=t,se-=e,re.add(A(ne*ne+se*se)),ne=t,se=e}var he=ae;let ce,de,ue,pe;class ge{constructor(t){this._append=null==t?fe:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return fe;if(e!==ce){const t=10**e;ce=e,de=function(e){let i=1;this._+=e[0];for(const n=e.length;i=0))throw new RangeError(`invalid digits: ${t}`);s=e}return null===e&&(n=new ge(s)),a},a.projection(t).digits(s).context(e)}function ye(t){return function(e){var i=new _e;for(var n in t)i[n]=t[n];return i.stream=e,i}}function _e(){}function ve(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),D(i,t.stream(Bt)),e(Bt.result()),null!=n&&t.clipExtent(n),t}function be(t,e,i){return ve(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function xe(t,e,i){return be(t,[[0,0],e],i)}function Se(t,e,i){return ve(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function we(t,e,i){return ve(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}_e.prototype={constructor:_e,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Ae=16,ke=_(30*g);function Me(t,e){return+e?function(t,e){function i(n,s,r,a,l,h,c,d,u,p,g,m,_,v){var b=c-n,x=d-s,S=b*b+x*x;if(S>4*e&&_--){var w=a+p,k=l+g,M=h+m,T=A(w*w+k*k+M*M),E=C(M/=T),R=f(f(M)-1)e||f((b*D+x*L)/S-.5)>.3||a*p+l*g+h*m2?t[2]%360*g:0,B()):[_*p,v*p,b*p]},R.angle=function(t){return arguments.length?(x=t%360*g,B()):x*p},R.reflectX=function(t){return arguments.length?(S=t?-1:1,B()):S<0},R.reflectY=function(t){return arguments.length?(w=t?-1:1,B()):w<0},R.precision=function(t){return arguments.length?(a=Me(o,E=t*t),I()):A(E)},R.fitExtent=function(t,e){return be(R,t,e)},R.fitSize=function(t,e){return xe(R,t,e)},R.fitWidth=function(t,e){return Se(R,t,e)},R.fitHeight=function(t,e){return we(R,t,e)},function(){return e=t.apply(this,arguments),R.invert=e.invert&&P,B()}}function Pe(t){var e=0,i=h/3,n=Re(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*g,i=t[1]*g):[e*p,i*p]},s}function Be(t,e){var i=S(t),n=(i+S(e))/2;if(f(n)2?t[2]*g:0),e.invert=function(e){return(e=t.invert(e[0]*g,e[1]*g))[0]*=p,e[1]*=p,e},e}(s.rotate()).invert([0,0]));return l(null==c?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===He?[[Math.max(o[0]-r,c),e],[Math.min(o[0]+r,i),n]]:[[c,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),d()):a()},s.translate=function(t){return arguments.length?(o(t),d()):o()},s.center=function(t){return arguments.length?(r(t),d()):r()},s.clipExtent=function(t){return arguments.length?(null==t?c=e=i=n=null:(c=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),d()):null==c?null:[[c,e],[i,n]]},d()}function Ve(t){return k((c+t)/2)}function We(t,e){var i=_(t),n=t===e?S(t):b(i/_(e))/b(Ve(e)/Ve(t)),s=i*x(Ve(t),n)/n;if(!n)return He;function r(t,e){s>0?e<-c+o&&(e=-c+o):e>c-o&&(e=c-o);var i=s/x(Ve(e),n);return[i*S(n*t),s-i*_(n*t)]}return r.invert=function(t,e){var i=s-e,r=w(n)*A(t*t+i*i),a=y(t,f(i))*w(i);return i*n<0&&(a-=h*w(t)*w(i)),[a/n,2*m(x(s/r,1/n))-c]},r}function Ue(t,e){return[t,e]}function Ge(t,e){var i=_(t),n=t===e?S(t):(i-_(e))/(e-t),s=i/n+t;if(f(n)o&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ti.invert=Oe(C),ei.invert=Oe((function(t){return 2*m(t)})),ii.invert=function(t,e){return[-e,2*m(v(t))-c]},je().translate([0,0]).center([0,0]).scale(63781);var ni="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function si(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ri(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var ai=Object.prototype.hasOwnProperty;function oi(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^di[2]^di[3])}function pi(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=oi(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return ui(r[t])}function S(t,e){return li(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=mi(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ci(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Ti(t,e)}))}:Ti(t,e)}function Ti(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=Ei(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function Ei(t,e){var i=ki(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function Ii(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Mi(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=Di(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=ji(t.slice(0,n),e),o=ji(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Ni=ji;!function(t){var e=Ni;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;rObject.prototype.toString.call(t)===`[object ${e}]`,Yi=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||Gi(t,"Boolean")},$i=t=>"function"==typeof t,Xi=t=>null==t,Ki=t=>null!=t,qi=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},Zi=t=>"object"==typeof t&&null!==t,Ji=function(t){if(!Zi(t)||!Gi(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},Qi=t=>void 0===t,tn=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||Gi(t,"String")},en=t=>Array.isArray?Array.isArray(t):Gi(t,"Array"),nn=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},sn=t=>Gi(t,"Date"),rn=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||Gi(t,"Number")},an=t=>rn(t)&&Number.isFinite(t),on=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),ln=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),hn=Object.prototype,cn=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||hn)},dn=Object.prototype.hasOwnProperty;function un(t){if(Xi(t))return!0;if(nn(t))return!t.length;const e=ln(t);if("Map"===e||"Set"===e)return!t.size;if(cn(t))return!Object.keys(t).length;for(const e in t)if(dn.call(t,e))return!1;return!0}const pn=(t,e,i)=>{const n=tn(e)?e.split("."):e;for(let e=0;enull!=t&&gn.call(t,e);function mn(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(en(i)?o=[]:Gi(i,"RegExp")?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=sn(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)}function yn(t){let e;if(!Ki(t)||"object"!=typeof t)return t;const i=en(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:Yi(t)||rn(t)||tn(t)?t:sn(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=yn(n)}return e}function _n(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(Ki(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];Ki(n[r])&&"object"==typeof n[r]?vn(t,e,r,i):bn(t,r,n[r])}}}}function vn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(en(r)){if(n)a=[];else if(en(s))a=s;else if(nn(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!An(t[i],e[i]))return!1;return!0}if(!Ji(t))return!1;const i=wn(t),n=wn(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!An(t[s],e[s]))return!1}return!0}function kn(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function Rn(t,e){if(!en(t)||!en(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Bn(t,e,i){Ki(e)||(e=t,t=0),Ki(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function Dn(t){return Number(t)}function Ln(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Dn;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function On(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(Xi(n)&&(n=t.length);i>>1;In(t[s],e)>0?n=s:i=s+1}return i}const Fn=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(In)),Ln(i,.5)},zn=Math.sqrt(50),Hn=Math.sqrt(10),jn=Math.sqrt(2);function Nn(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=zn?s*=10:r>=Hn?s*=5:r>=jn&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:Vn,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wn)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function Gn(t,e,i,n){return t>e&&!Un(t,e,i,n)}function Yn(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},Xn=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?$n(n,r)+s:"center"===i?$n(n,Math.floor(r/2))+s+$n(n,Math.ceil(r/2)):s+$n(n,r)},Kn=function(t,e,i){return ti?i:t},qn=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function Zn(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let Jn=!1;try{Jn="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){Jn=!1}function Qn(t,e,i){let n,s,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&Jn;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function m(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(m(t))return _(t);o=f(y,function(t){const i=t-h,n=e-(t-l);return d?Math.min(n,r-i):n}(t))}function _(t){return o=void 0,u&&n?g(t):(n=s=void 0,a)}function v(){const t=Date.now(),i=m(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function is(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}Jn=!1;const ns=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ss=new RegExp(ns.source,"g");const rs=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function as(t){if(t instanceof Date)return t;if(tn(t)){const e=rs.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return Xi(t)?new Date(NaN):new Date(Math.round(t))}const os=1e-12,ls=Math.PI,hs=ls/2,cs=2*ls,ds=2*Math.PI,us=Math.abs,ps=Math.atan2,gs=Math.cos,fs=Math.max,ms=Math.min,ys=Math.sin,_s=Math.sqrt,vs=Math.pow;function bs(t){return t>1?0:t<-1?ls:Math.acos(t)}function xs(t){return t>=1?hs:t<=-1?-hs:Math.asin(t)}function Ss(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function ws(t,e){return t[0]*e[1]-t[1]*e[0]}class As{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new As(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return rn(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return rn(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ks{static distancePP(t,e){return _s(vs(t.x-e.x,2)+vs(t.y-e.y,2))}static distanceNN(t,e,i,n){return _s(vs(t-i,2)+vs(e-n,2))}static distancePN(t,e,i){return _s(vs(e-t.x,2)+vs(i-t.y,2))}static pointAtPP(t,e,i){return new As((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Ms(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Cs{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Cs(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return en(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ms(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class Ts extends Cs{}function Es(t){return t*(Math.PI/180)}function Rs(t){return 180*t/Math.PI}const Ps=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-cs;)t+=cs;else if(t>0)for(;t>cs;)t-=cs;return t},Bs=Ps;function Is(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Ds(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class Ls{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new Ls,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ls;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ls(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=Rs(r.rotateDeg),r}}function Os(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Fs(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const zs=/^#([0-9a-f]{3,8})$/,Hs={transparent:4294967040},js={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ns(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Vs(t){return rn(t)?new Us(t>>16,t>>8&255,255&t,1):en(t)?new Us(t[0],t[1],t[2]):new Us(255,255,255)}let Ws=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(Ki(Hs[t]))return function(t){return rn(t)?new Us(t>>>24,t>>>16&255,t>>>8&255,255&t):en(t)?new Us(t[0],t[1],t[2],t[3]):new Us(255,255,255,1)}(Hs[t]);if(Ki(js[t]))return Vs(js[t]);const e=`${t}`.trim().toLowerCase(),i=zs.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Us((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Vs(t):8===e?new Us(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Us(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Os(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Us(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new Us(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Fs(this.color.r,this.color.g,this.color.b),r=Os(Xi(t)?s.h:Kn(t,0,360),Xi(e)?s.s:e>=0&&e<=1?100*e:e,Xi(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new Us(r.r,r.g,r.b,n),this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}};class Us{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),Ki(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${Ns(this.r)+Ns(this.g)+Ns(this.b)+(1===this.opacity?"":Ns(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Fs(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Gs(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new Us(e,c,d,l*(1-t)+h*t)}},rgbToHex:Ys,rgbToHsl:Fs});function Xs(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Ks,qs,Zs,Js,Qs,tr,er,ir;function nr(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}var rr;function ar(t,e,i){return!(t&&e&&(i?(Ks=t.x1,qs=t.x2,Zs=t.y1,Js=t.y2,Qs=e.x1,tr=e.x2,er=e.y1,ir=e.y2,Ks>qs&&([Ks,qs]=[qs,Ks]),Zs>Js&&([Zs,Js]=[Js,Zs]),Qs>tr&&([Qs,tr]=[tr,Qs]),er>ir&&([er,ir]=[ir,er]),Ks>tr||qsir||Jse.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function hr(t){return t/180*Math.PI}function cr(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function dr(t,e){const i=e?t.angle:hr(t.angle),n=cr(t);return[lr({x:t.x1,y:t.y1},i,n),lr({x:t.x2,y:t.y1},i,n),lr({x:t.x2,y:t.y2},i,n),lr({x:t.x1,y:t.y2},i,n)]}let ur,pr,gr,fr;function mr(t){return ur=1/0,pr=1/0,gr=-1/0,fr=-1/0,t.forEach((t=>{ur>t.x&&(ur=t.x),grt.y&&(pr=t.y),fre&&r>n||rs?o:0}function xr(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class wr{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),Ki(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=Ki(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(Xi(this._canvas)&&(Ki(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),Xi(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&Ki(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),Xi(this._context)&&Ki(this._canvas)){const t=this._canvas.getContext("2d");Ki(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!Xi(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(Xi(t))return{width:0,height:0};if(Xi(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(Xi(this._numberCharSize)){const t=this._standardMethod(wr.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/wr.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return Xi(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(wr.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(Xi(this._letterCharSize)){const t=this._standardMethod(wr.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/wr.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return Ki(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){Ki(this._canvas)&&(this._canvas=null),Ki(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}wr.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",wr.NUMBERS_CHAR_SET="0123456789",wr.FULL_SIZE_CHAR="字";const Ar="undefined"!=typeof console;function kr(t,e,i){const n=[e].concat([].slice.call(i));Ar&&console[t].apply(console,n)}var Mr;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(Mr||(Mr={}));let Cr=class t{static getInstance(e,i){return t._instance&&rn(e)?t._instance.level(e):t._instance||(t._instance=new t(e,i)),t._instance}static setInstance(e){return t._instance=e}static setInstanceLevel(e){t._instance?t._instance.level(e):t._instance=new t(e)}static clearInstance(){t._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mr.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Mr.Info}canLogDebug(){return this._level>=Mr.Debug}canLogError(){return this._level>=Mr.Error}canLogWarn(){return this._level>=Mr.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Mr.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):kr(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Mr.Warn&&kr(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Mr.Info&&kr(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Mr.Debug&&kr(this._method||"log","DEBUG",e),this}};function Tr(t){if(an(t))return[t,t,t,t];if(en(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(qi(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Er(t){return t?"getUTCFullYear":"getFullYear"}function Rr(t){return t?"getUTCMonth":"getMonth"}function Pr(t){return t?"getUTCDate":"getDate"}function Br(t){return t?"getUTCHours":"getHours"}function Ir(t){return t?"getUTCMinutes":"getMinutes"}function Dr(t){return t?"getUTCSeconds":"getSeconds"}function Lr(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Or(t){return t?"setUTCFullYear":"setFullYear"}Cr._instance=null;const Fr=1e3,zr=6e4,Hr=36e5,jr=24*Hr,Nr=31*jr,Vr=365*jr,Wr=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),Ur=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),Gr=(t,e)=>e.getFullYear()-t.getFullYear(),Yr=t=>t.getFullYear(),$r=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),Xr=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),Kr=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),qr=t=>t.getUTCFullYear(),Zr=t=>(t.setDate(1),t.setHours(0,0,0,0),t),Jr=(t,e)=>(t.setMonth(t.getMonth()+e),t),Qr=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),ta=t=>t.getMonth(),ea=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),ia=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),na=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),sa=t=>t.getUTCMonth(),ra=t=>(t.setHours(0,0,0,0),t),aa=(t,e)=>(t.setDate(t.getDate()+e),t),oa=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/jr,la=t=>t.getDate()-1,ha=t=>(t.setUTCHours(0,0,0,0),t),ca=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),da=(t,e)=>(+e-+t)/jr,ua=t=>t.getUTCDate()-1,pa=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),ga=(t,e)=>(t.setHours(t.getHours()+e),t),fa=(t,e)=>(+e-+t)/Hr,ma=t=>t.getHours(),ya=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),_a=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),va=t=>t.getUTCHours(),ba=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),xa=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Sa=(t,e)=>(+e-+t)/6e4,wa=t=>t.getMinutes(),Aa=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),ka=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Ma=t=>t.getUTCMinutes(),Ca=t=>(t.setTime(+t-t.getMilliseconds()),t),Ta=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ea=(t,e)=>(+e-+t)/1e3,Ra=t=>t.getSeconds(),Pa=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),Ba=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ia=t=>t.getUTCSeconds(),Da=t=>t,La=(t,e)=>(t.setTime(+t+e),t),Oa=(t,e)=>+e-+t,Fa=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},za=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Fa(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Fa(h,c)}};function Ha(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function ja(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var Na=6371008.8,Va={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*Na,kilometers:6371.0088,kilometres:6371.0088,meters:Na,metres:Na,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Na/1852,radians:1,yards:6967335.223679999};function Wa(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function Ua(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function Ga(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(Ks=e.x1,qs=e.x2,Zs=e.y1,Js=e.y2,Ks>qs&&([Ks,qs]=[qs,Ks]),Zs>Js&&([Zs,Js]=[Js,Zs]),t.x>=Ks&&t.x<=qs&&t.y>=Zs&&t.y<=Js):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function Ya(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Es(t[0]),r=Es(t[1]),a=Es(i),o=function(t,e){void 0===e&&(e="kilometers");var i=Va[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Rs(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Rs(l)}}const $a=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n{const i=$a(qa,e),{tolerance:n}=i;return Vi(t,n)};var Ja;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Ja||(Ja={}));const Qa=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},to=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+ro(e,6):ro(e,4))+"-"+ro(t.getUTCMonth()+1,2)+"-"+ro(t.getUTCDate(),2)+(r?"T"+ro(i,2)+":"+ro(n,2)+":"+ro(s,2)+"."+ro(r,3)+"Z":s?"T"+ro(i,2)+":"+ro(n,2)+":"+ro(s,2)+"Z":n||i?"T"+ro(i,2)+":"+ro(n,2)+"Z":"")}function oo(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return io;if(h)return h=!1,eo;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Ja.DSV;const i=$a(co,e),{delimiter:n}=i;if(!tn(n))throw new TypeError("Invalid delimiter: must be a string!");return oo(n).parse(t)},po=function(t){return(arguments.length>2?arguments[2]:void 0).type=Ja.DSV,lo(t)},go=function(t){return(arguments.length>2?arguments[2]:void 0).type=Ja.DSV,ho(t)};function fo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return mo(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return mo(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return _o(t);default:throw new Error("unknown GeoJSON type")}}function mo(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=yo(t.properties),e.geometry=_o(t.geometry),e}function yo(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=yo(n):e[i]=n})),e):e}function _o(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return _o(t)})),e):(e.coordinates=vo(t.coordinates),e)}function vo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return vo(t)}))}function bo(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function xo(t){for(var e,i,n=bo(t),s=0,r=1;r0}function So(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=fo(t));var r=[];switch(t.type){case"GeometryCollection":return wo(t,(function(t){ko(t,n)})),t;case"FeatureCollection":return So(t,(function(t){So(ko(t,n),(function(t){r.push(t)}))})),Ua(r)}return ko(t,n)}function ko(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return wo(t,(function(t){ko(t,e)})),t;case"LineString":return Mo(bo(t),e),t;case"Polygon":return Co(bo(t),e),t;case"MultiLineString":return bo(t).forEach((function(t){Mo(t,e)})),t;case"MultiPolygon":return bo(t).forEach((function(t){Co(t,e)})),t;case"Point":case"MultiPoint":return t}}function Mo(t,e){xo(t)===e&&t.reverse()}function Co(t,e){xo(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=To(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Bo=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Ja.GEO;const i=$a(Ro,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Po(t))})):e.push(Po(t))})),e})(t);let o=t.features;return a&&(o=Ao(t,{reverse:!qi(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Eo.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Eo.bounds(t);t.bbox=e}})),t.features=o,t},Io={},Do=(t,e,i)=>{i.type=Ja.GEO;const n=$a(Ro,Io,e),{object:s}=n;if(!tn(s))throw new TypeError("Invalid object: must be a string!");const r=Ci(t,t.objects[s]);return Bo(r,n,i)},Lo=(t,e,i)=>{const n=!Yi(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!en(t))throw new TypeError("Invalid data: must be DataView array!");return en(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Oo=0;function Fo(){return Oo>1e8&&(Oo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+Oo++}class zo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new Ui,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Fo("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){this.transformMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const Ho="_data-view-diff-rank";class jo{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new Ui,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Fo("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",to),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=yn(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=yn(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[Ho]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[Ho]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[Ho][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear};utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear};parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1};parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1};parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1};parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1};parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1};parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1};parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1};parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Vo(t,e){const i=new Set(Cn(t)),n=new Set(Cn(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Wo}=$s,Uo=(t,e)=>($i(Yo.warnHandler)&&Yo.warnHandler.call(null,t,e),e?Cr.getInstance().warn(`[VChart warn]: ${t}`,e):Cr.getInstance().warn(`[VChart warn]: ${t}`)),Go=(t,e,i)=>{const n=new Error(t);return Cr.getInstance().error(`[VChart error]: ${n}`,e)},Yo={silent:!1,warnHandler:!1,errorHandler:!1},$o="undefined"!=typeof window&&void 0!==window.document,Xo=$o&&globalThis.document;function Ko(t){return("desktop-browser"===t||"mobile-browser"===t)&&$o}function qo(t){return"miniApp"===t||"mobile-browser"===t}function Zo(t){return t.includes("miniApp")||"lynx"===t}let Jo=0;function Qo(){return Jo>=9999999&&(Jo=0),Jo++}function tl(t){return!Xi(t)&&(!!rn(t)||+t==+t)}function el(t){return!(!t||0===t.length)&&(!Xi(t[0])&&!Xi(t[0].dataId)&&en(t[0].fields))}const il=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const nl=t=>e=>pn(e,t);function sl(t,e,i){const n=[e].concat([].slice.call(i));console[t].apply(console,n)}var rl;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rl||(rl={}));class al{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rl.None,e=arguments.length>1?arguments[1]:void 0;this._level=t,this._method=e}canLogInfo(){return this._level>=rl.Info}canLogDebug(){return this._level>=rl.Debug}canLogError(){return this._level>=rl.Error}canLogWarn(){return this._level>=rl.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=rl.Error&&sl(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rl.Warn&&sl(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rl.Info&&sl(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rl.Debug&&sl(this._method||"log","DEBUG",e),this}}let ol=null;const ll=(t,e)=>(ol&&rn(t)?ol.level(t):ol||(ol=new al(t,e)),ol),hl=t=>{ll().error(t)},cl=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if($i(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||hl("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&hl("Access path missing closing bracket: "+t),a&&hl("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return il((i&&i.get||nl)(n),[s],e||s)},dl=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(en(t)){const n=t.map((t=>cl(t,e,i)));return t=>n.map((e=>e(t)))}return cl(t,e,i)};dl("id");const ul=il((function(t){return t}),[],"identity"),pl=il((function(){return 0}),[],"zero");il((function(){return 1}),[],"one"),il((function(){return!0}),[],"true"),il((function(){return!1}),[],"false"),il((function(){return{}}),[],"emptyObject");const gl=(t,e)=>{if((te||Xi(e))&&!Xi(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},fl=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>gl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=Cn(e)||[],s=[],r=[],a={},o=i.comparator||fl;return Cn(t).forEach(((t,e)=>{if(Xi(t))return;s.push("desc"===n[e]?-1:1);const o=$i(t)?t:dl(t,null,i);var l;r.push(o),(l=o,(Xi(l)?null:l.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:il(o(r,s),Object.keys(a))},yl=(t,e)=>{const i=$i(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(Xi(e)||Xi(i))return Xi(e)&&Xi(i);if(!Zi(e)&&!Zi(i))return e===i;const s=en(e)?e:e[t],r=en(i)?i:i[t];return s===r||!1!==n&&(en(r)?!(!en(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!qi(r)&&!(!qi(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>_l(t,r,s)))))},vl=(t,e)=>Xi(t)?e:Math.min(tn(t)?e*parseFloat(t)/100:t,e);function bl(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!Xi(s)&&(s=+s)>=s&&!Xi(r)&&(r=+r)>=r&&n(s,r,++a)}))}function xl(t,e,i,n,s){let r=0,a=0;return bl(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function Sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;bl(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:xl(t,e,i,s,h)}}const wl=Un;function Al(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const kl=t=>an(t)?Es(t):null,Ml=t=>an(t)?Rs(t):null;function Cl(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Tl(t,e,i,n){const s=Cl({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function El(t){return 3===t||4===t}function Rl(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}function Pl(t,e){const i=e?+t[0][e]:+t[0];if(!an(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return an(n)&&n{const n=e?+i[e]:+i;return an(n)&&n>t&&(t=n),t}),i)}function Il(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;an(s)&&(i+=s,n++)}));return i/n}function Dl(t,e){const i=Il(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Ll(t){let e="center",i="middle";return e=(t=Al(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}}function Ol(t,e){const i=Fl(t),n=Fl(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function Fl(t,e={x:0,y:0}){return ks.distancePP(t,e)}function zl(t,e,i){let n=!1;if(e&&$i(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function Hl(t){return function(e){let i;return i=en(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var jl;function Nl(t){switch(t){case jl.Linear:case jl.Log:case jl.Pow:case jl.Sqrt:case jl.Symlog:case jl.Time:return!0;default:return!1}}function Vl(t){switch(t){case jl.Linear:case jl.Log:case jl.Pow:case jl.Sqrt:case jl.Symlog:case jl.Time:case jl.Ordinal:case jl.Point:case jl.Band:return!0;default:return!1}}function Wl(t){switch(t){case jl.Ordinal:case jl.Point:case jl.Band:return!0;default:return!1}}!function(t){t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(jl||(jl={}));class Ul{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Gl=Symbol("implicit");class Yl extends Ul{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=jl.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Gl}clone(){return(new Yl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!Xi(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==Gl)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Kl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),ql=t=>t<0?-t*t:t*t,Zl=t=>-Math.log(-t),Jl=t=>-Math.exp(-t),Ql=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,th=t=>10===t?Ql:t===Math.E?Math.exp:e=>Math.pow(t,e),eh=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),ih=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),nh=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function sh(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function rh(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function ah(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class hh extends Yl{constructor(t){super(),this.type=jl.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Bn(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[Dn(t[0]),Dn(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[Dn(t[0]),Dn(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:lh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return lh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=Zn(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}clone(){return new hh(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:ch}=$s;function dh(t,e){const i=typeof e;let n;if(Xi(e)||"boolean"===i)return()=>e;if("number"===i)return es(t,e);if("string"===i){if(n=Ws.parseColorString(e)){const e=ch(Ws.parseColorString(t),n);return t=>e(t).formatRgb()}return es(Number(t),Number(e))}return e instanceof Us?ch(t,e):e instanceof Ws?ch(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):es(Number(t),Number(e))}class uh extends Ul{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$l,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$l;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=$l,this._piecewise=rh,this._interpolate=dh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),es)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,Dn);return this._domain=i,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=is,this.rescale(e)}rescale(t){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=Zn(this._domain[0],this._domain[n-1])),this._piecewise=n>2?ah:rh,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:$l),this.rescale(i)):this._clamp!==$l}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ph=Math.sqrt(50),gh=Math.sqrt(10),fh=Math.sqrt(2);function mh(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=ph?a=10:r>=gh?a=5:r>=fh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function _h(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=yh(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class xh extends uh{constructor(){super(...arguments),this.type=jl.Linear}clone(){return(new xh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return _h(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return vh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=bh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=bh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=bh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function Sh(t){return e=>-t(-e)}class wh extends uh{constructor(){super(eh(10),th(10)),this.type=jl.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new wh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){if(t)return this;super.rescale();const e=eh(this._base),i=th(this._base);return this._domain[0]<0?(this._logs=Sh(e),this._pows=Sh(i),this.transformer=Zl,this.untransformer=Jl):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return $l}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.lengththis._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}}class Ah extends hh{constructor(t){super(!1),this.type=jl.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class kh extends xh{constructor(){super(),this.type=jl.Pow,this._exponent=1}clone(){return(new kh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=$l,this.untransformer=$l):.5===this._exponent?(this.transformer=Kl,this.untransformer=ql):(this.transformer=Xl(this._exponent),this.untransformer=Xl(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function Mh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class Ch{constructor(){this.type=jl.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return Mh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new Th).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return mh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return _h(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return vh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=bh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=bh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=bh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class Eh extends xh{constructor(){super(Kl,ql),this.type=jl.Sqrt}clone(){return(new Eh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Rh extends xh{constructor(){super(ih(1),nh(1)),this.type=jl.Symlog,this._const=1}clone(){return(new Rh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=ih(t),this.untransformer=nh(t),this.rescale(e)):this._const}}class Ph{constructor(){this.type=jl.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!Xi(t)&&an(+t)?this._range[On(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new Ph).domain(this._domain).range(this._range).unknown(this._unknown)}}const Bh=[["second",1,Fr],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,zr],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,Hr],["hour",3,3*Hr],["hour",6,6*Hr],["hour",12,12*Hr],["day",1,jr],["day",2,2*jr],["day",7,7*jr],["month",1,Nr],["month",3,3*Nr],["month",6,6*Nr],["year",1,365*jr]];function Ih(t){return+as(t)}function Dh(t,e,i,n){const s=(+e-+t)/i,r=On(Bh.map((t=>t[2])),s);if(r===Bh.length){const s=Math.max(Nn(+t/Vr,+e/Vr,i),1),r=t=>(t[Or(n)](Math.floor(t[Er(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Or(n)](t[Er(n)]()+e*s),t);return{floor:r,offset:a,ceil:Fa(r,a)}}if(0===r){const n=Math.max(Nn(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Fa(s,r)}}const[a,o]=Bh[s/Bh[r-1][2]"year"===t&&e?{floor:$r,offset:Xr,count:Kr,field:qr}:"month"===t&&e?{floor:ea,offset:ia,count:na,field:sa}:"day"===t&&e?{floor:ha,offset:ca,count:da,field:ua}:"hour"===t&&e?{floor:ya,offset:_a,count:fa,field:va}:"minute"===t&&e?{floor:Aa,offset:ka,count:Sa,field:Ma}:"second"===t&&e?{floor:Pa,offset:Ba,count:Ea,field:Ia}:"year"===t?{floor:Wr,offset:Ur,count:Gr,field:Yr}:"month"===t?{floor:Zr,offset:Jr,count:Qr,field:ta}:"day"===t?{floor:ra,offset:aa,count:oa,field:la}:"hour"===t?{floor:pa,offset:ga,count:fa,field:ma}:"minute"===t?{floor:ba,offset:xa,count:Sa,field:wa}:"second"===t?{floor:Ca,offset:Ta,count:Ea,field:Ra}:{floor:Da,offset:La,count:Oa})(a,n);return za(o,l)}class Lh extends uh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=jl.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(as);const i=Array.from(t,Ih);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=as(t),s=e[Er(n)](),r=e[Rr(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Pr(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[Br(n)](),c=(h-1)%12+1,d=e[Ir(n)](),u=e[Dr(n)](),p=e[Lr(n)]();return(i||"").replace(/YYYY/g,Xn(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,Xn(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,Xn(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,Xn(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,Xn(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,Xn(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,Xn(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,Xn(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Lh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(rn(t)||Xi(t))&&(i=Dh(e[0],e[e.length-1],Xi(t)?10:t,this._isUtc)),i&&this.domain(oh(e,i)),this}utc(){return this._isUtc}}function Oh(t,e){const i=Ki(e)?t?.[e]??t?.default:t?.default;if(!i||en(i))return i;if(qi(i)){const{dataScheme:n}=i;return n?Nh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>jh(i)?zh(t,i,e):i)).filter(Ki)}))):n.map((i=>jh(i)?zh(t,i,e):i)).filter(Ki):[]}return[]}function Fh(t,e){return Nh(t)?t.find((t=>Ki(t.isAvailable)?$i(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!Ki(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function zh(t,e,i){const n=Ki(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!Ki(e.a)&&!Ki(e.l)||!tn(s))return s;let r=new Wo(s);if(Ki(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Fs(t,i,n),o=Os(s,a,e.l),l=new Wo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return Ki(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Hh=(t,e,i)=>{if(jh(t)&&e){const n=zh(e,t,i);if(n)return n}return t};function jh(t){return qi(t)&&"palette"===t.type&&!!t.key}function Nh(t){return!!en(t)&&t.every((t=>Ki(t.scheme)))}class Vh extends Yl{_range;range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Nh(this._range))return void super.range(this._range);const t=Fh(this._range,this._domain);super.range(t)}}const Wh={linear:xh,band:hh,point:Ah,ordinal:Yl,threshold:Ph,colorOrdinal:Vh};function Uh(t){const e=Wh[t];return e?new e:null}function Gh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Yh(t){return Ki(t?.field)&&Ki(t?.scale)}var $h;function Xh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Kh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function qh(t){return!!tn(t)&&(!!t.endsWith("%")&&tl(t.substring(0,t.length-1)))}function Zh(t,e,i){return rn(t)?t:qh(t)?Number(t.substring(0,t.length-1))*e/100:$i(t)?t(i):0}function Jh(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>rn(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=Zh(t[s],e.size,i)}))})),n}function Qh(t){let e={};return en(t)?(Xi(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),Xi(t[1])||(e.left=e.right=t[1]),Xi(t[2])||(e.bottom=t[2]),Xi(t[3])||(e.left=t[3]),e):rn(t)||qh(t)||$i(t)?(e.top=e.left=e.bottom=e.right=t,e):(qi(t)&&(e={...t}),e)}function tc(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function ec(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=ec(t[n],e)}return i}return en(t)?t.map((t=>ec(t,e))):t}function ic(t){const e=t;let i;if(!Ki(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof jo||e.every((t=>i.includes(t)))}(e))return e;const n=en(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:Yi(e)||rn(e)||tn(e)?e:sn(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=ic(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}($h||($h={}));var nc=function(t){return t&&t.Math==Math&&t},sc=nc("object"==typeof globalThis&&globalThis)||nc("object"==typeof window&&window)||nc("object"==typeof self&&self)||nc("object"==typeof ni&&ni)||function(){return this}()||ni||Function("return this")(),rc={},ac=function(t){try{return!!t()}catch(t){return!0}},oc=!ac((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),lc=!ac((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),hc=lc,cc=Function.prototype.call,dc=hc?cc.bind(cc):function(){return cc.apply(cc,arguments)},uc={},pc={}.propertyIsEnumerable,gc=Object.getOwnPropertyDescriptor,fc=gc&&!pc.call({1:2},1);uc.f=fc?function(t){var e=gc(this,t);return!!e&&e.enumerable}:pc;var mc,yc,_c=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},vc=lc,bc=Function.prototype,xc=bc.call,Sc=vc&&bc.bind.bind(xc,xc),wc=vc?Sc:function(t){return function(){return xc.apply(t,arguments)}},Ac=wc,kc=Ac({}.toString),Mc=Ac("".slice),Cc=function(t){return Mc(kc(t),8,-1)},Tc=ac,Ec=Cc,Rc=Object,Pc=wc("".split),Bc=Tc((function(){return!Rc("z").propertyIsEnumerable(0)}))?function(t){return"String"==Ec(t)?Pc(t,""):Rc(t)}:Rc,Ic=function(t){return null==t},Dc=Ic,Lc=TypeError,Oc=function(t){if(Dc(t))throw Lc("Can't call method on "+t);return t},Fc=Bc,zc=Oc,Hc=function(t){return Fc(zc(t))},jc="object"==typeof document&&document.all,Nc={all:jc,IS_HTMLDDA:void 0===jc&&void 0!==jc},Vc=Nc.all,Wc=Nc.IS_HTMLDDA?function(t){return"function"==typeof t||t===Vc}:function(t){return"function"==typeof t},Uc=Wc,Gc=Nc.all,Yc=Nc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Uc(t)||t===Gc}:function(t){return"object"==typeof t?null!==t:Uc(t)},$c=sc,Xc=Wc,Kc=function(t,e){return arguments.length<2?(i=$c[t],Xc(i)?i:void 0):$c[t]&&$c[t][e];var i},qc=wc({}.isPrototypeOf),Zc=sc,Jc="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Qc=Zc.process,td=Zc.Deno,ed=Qc&&Qc.versions||td&&td.version,id=ed&&ed.v8;id&&(yc=(mc=id.split("."))[0]>0&&mc[0]<4?1:+(mc[0]+mc[1])),!yc&&Jc&&(!(mc=Jc.match(/Edge\/(\d+)/))||mc[1]>=74)&&(mc=Jc.match(/Chrome\/(\d+)/))&&(yc=+mc[1]);var nd=yc,sd=ac,rd=sc.String,ad=!!Object.getOwnPropertySymbols&&!sd((function(){var t=Symbol();return!rd(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&nd&&nd<41})),od=ad&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ld=Kc,hd=Wc,cd=qc,dd=Object,ud=od?function(t){return"symbol"==typeof t}:function(t){var e=ld("Symbol");return hd(e)&&cd(e.prototype,dd(t))},pd=String,gd=function(t){try{return pd(t)}catch(t){return"Object"}},fd=Wc,md=gd,yd=TypeError,_d=function(t){if(fd(t))return t;throw yd(md(t)+" is not a function")},vd=_d,bd=Ic,xd=function(t,e){var i=t[e];return bd(i)?void 0:vd(i)},Sd=dc,wd=Wc,Ad=Yc,kd=TypeError,Md={exports:{}},Cd=sc,Td=Object.defineProperty,Ed=function(t,e){try{Td(Cd,t,{value:e,configurable:!0,writable:!0})}catch(i){Cd[t]=e}return e},Rd=Ed,Pd="__core-js_shared__",Bd=sc[Pd]||Rd(Pd,{}),Id=Bd;(Md.exports=function(t,e){return Id[t]||(Id[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Dd=Md.exports,Ld=Oc,Od=Object,Fd=function(t){return Od(Ld(t))},zd=Fd,Hd=wc({}.hasOwnProperty),jd=Object.hasOwn||function(t,e){return Hd(zd(t),e)},Nd=wc,Vd=0,Wd=Math.random(),Ud=Nd(1..toString),Gd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Ud(++Vd+Wd,36)},Yd=Dd,$d=jd,Xd=Gd,Kd=ad,qd=od,Zd=sc.Symbol,Jd=Yd("wks"),Qd=qd?Zd.for||Zd:Zd&&Zd.withoutSetter||Xd,tu=function(t){return $d(Jd,t)||(Jd[t]=Kd&&$d(Zd,t)?Zd[t]:Qd("Symbol."+t)),Jd[t]},eu=dc,iu=Yc,nu=ud,su=xd,ru=function(t,e){var i,n;if("string"===e&&wd(i=t.toString)&&!Ad(n=Sd(i,t)))return n;if(wd(i=t.valueOf)&&!Ad(n=Sd(i,t)))return n;if("string"!==e&&wd(i=t.toString)&&!Ad(n=Sd(i,t)))return n;throw kd("Can't convert object to primitive value")},au=TypeError,ou=tu("toPrimitive"),lu=function(t,e){if(!iu(t)||nu(t))return t;var i,n=su(t,ou);if(n){if(void 0===e&&(e="default"),i=eu(n,t,e),!iu(i)||nu(i))return i;throw au("Can't convert object to primitive value")}return void 0===e&&(e="number"),ru(t,e)},hu=ud,cu=function(t){var e=lu(t,"string");return hu(e)?e:e+""},du=Yc,uu=sc.document,pu=du(uu)&&du(uu.createElement),gu=function(t){return pu?uu.createElement(t):{}},fu=gu,mu=!oc&&!ac((function(){return 7!=Object.defineProperty(fu("div"),"a",{get:function(){return 7}}).a})),yu=oc,_u=dc,vu=uc,bu=_c,xu=Hc,Su=cu,wu=jd,Au=mu,ku=Object.getOwnPropertyDescriptor;rc.f=yu?ku:function(t,e){if(t=xu(t),e=Su(e),Au)try{return ku(t,e)}catch(t){}if(wu(t,e))return bu(!_u(vu.f,t,e),t[e])};var Mu={},Cu=oc&&ac((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Tu=Yc,Eu=String,Ru=TypeError,Pu=function(t){if(Tu(t))return t;throw Ru(Eu(t)+" is not an object")},Bu=oc,Iu=mu,Du=Cu,Lu=Pu,Ou=cu,Fu=TypeError,zu=Object.defineProperty,Hu=Object.getOwnPropertyDescriptor,ju="enumerable",Nu="configurable",Vu="writable";Mu.f=Bu?Du?function(t,e,i){if(Lu(t),e=Ou(e),Lu(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Vu in i&&!i[Vu]){var n=Hu(t,e);n&&n[Vu]&&(t[e]=i.value,i={configurable:Nu in i?i[Nu]:n[Nu],enumerable:ju in i?i[ju]:n[ju],writable:!1})}return zu(t,e,i)}:zu:function(t,e,i){if(Lu(t),e=Ou(e),Lu(i),Iu)try{return zu(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Fu("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var Wu=Mu,Uu=_c,Gu=oc?function(t,e,i){return Wu.f(t,e,Uu(1,i))}:function(t,e,i){return t[e]=i,t},Yu={exports:{}},$u=oc,Xu=jd,Ku=Function.prototype,qu=$u&&Object.getOwnPropertyDescriptor,Zu=Xu(Ku,"name"),Ju={EXISTS:Zu,PROPER:Zu&&"something"===function(){}.name,CONFIGURABLE:Zu&&(!$u||$u&&qu(Ku,"name").configurable)},Qu=Wc,tp=Bd,ep=wc(Function.toString);Qu(tp.inspectSource)||(tp.inspectSource=function(t){return ep(t)});var ip,np,sp,rp=tp.inspectSource,ap=Wc,op=sc.WeakMap,lp=ap(op)&&/native code/.test(String(op)),hp=Gd,cp=Dd("keys"),dp=function(t){return cp[t]||(cp[t]=hp(t))},up={},pp=lp,gp=sc,fp=Yc,mp=Gu,yp=jd,_p=Bd,vp=dp,bp=up,xp="Object already initialized",Sp=gp.TypeError,wp=gp.WeakMap;if(pp||_p.state){var Ap=_p.state||(_p.state=new wp);Ap.get=Ap.get,Ap.has=Ap.has,Ap.set=Ap.set,ip=function(t,e){if(Ap.has(t))throw Sp(xp);return e.facade=t,Ap.set(t,e),e},np=function(t){return Ap.get(t)||{}},sp=function(t){return Ap.has(t)}}else{var kp=vp("state");bp[kp]=!0,ip=function(t,e){if(yp(t,kp))throw Sp(xp);return e.facade=t,mp(t,kp,e),e},np=function(t){return yp(t,kp)?t[kp]:{}},sp=function(t){return yp(t,kp)}}var Mp={set:ip,get:np,has:sp,enforce:function(t){return sp(t)?np(t):ip(t,{})},getterFor:function(t){return function(e){var i;if(!fp(e)||(i=np(e)).type!==t)throw Sp("Incompatible receiver, "+t+" required");return i}}},Cp=wc,Tp=ac,Ep=Wc,Rp=jd,Pp=oc,Bp=Ju.CONFIGURABLE,Ip=rp,Dp=Mp.enforce,Lp=Mp.get,Op=String,Fp=Object.defineProperty,zp=Cp("".slice),Hp=Cp("".replace),jp=Cp([].join),Np=Pp&&!Tp((function(){return 8!==Fp((function(){}),"length",{value:8}).length})),Vp=String(String).split("String"),Wp=Yu.exports=function(t,e,i){"Symbol("===zp(Op(e),0,7)&&(e="["+Hp(Op(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Rp(t,"name")||Bp&&t.name!==e)&&(Pp?Fp(t,"name",{value:e,configurable:!0}):t.name=e),Np&&i&&Rp(i,"arity")&&t.length!==i.arity&&Fp(t,"length",{value:i.arity});try{i&&Rp(i,"constructor")&&i.constructor?Pp&&Fp(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Dp(t);return Rp(n,"source")||(n.source=jp(Vp,"string"==typeof e?e:"")),t};Function.prototype.toString=Wp((function(){return Ep(this)&&Lp(this).source||Ip(this)}),"toString");var Up=Yu.exports,Gp=Wc,Yp=Mu,$p=Up,Xp=Ed,Kp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Gp(i)&&$p(i,r,n),n.global)s?t[e]=i:Xp(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Yp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},qp={},Zp=Math.ceil,Jp=Math.floor,Qp=Math.trunc||function(t){var e=+t;return(e>0?Jp:Zp)(e)},tg=function(t){var e=+t;return e!=e||0===e?0:Qp(e)},eg=tg,ig=Math.max,ng=Math.min,sg=function(t,e){var i=eg(t);return i<0?ig(i+e,0):ng(i,e)},rg=tg,ag=Math.min,og=function(t){return t>0?ag(rg(t),9007199254740991):0},lg=function(t){return og(t.length)},hg=Hc,cg=sg,dg=lg,ug=function(t){return function(e,i,n){var s,r=hg(e),a=dg(r),o=cg(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},pg={includes:ug(!0),indexOf:ug(!1)},gg=jd,fg=Hc,mg=pg.indexOf,yg=up,_g=wc([].push),vg=function(t,e){var i,n=fg(t),s=0,r=[];for(i in n)!gg(yg,i)&&gg(n,i)&&_g(r,i);for(;e.length>s;)gg(n,i=e[s++])&&(~mg(r,i)||_g(r,i));return r},bg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],xg=vg,Sg=bg.concat("length","prototype");qp.f=Object.getOwnPropertyNames||function(t){return xg(t,Sg)};var wg={};wg.f=Object.getOwnPropertySymbols;var Ag=Kc,kg=qp,Mg=wg,Cg=Pu,Tg=wc([].concat),Eg=Ag("Reflect","ownKeys")||function(t){var e=kg.f(Cg(t)),i=Mg.f;return i?Tg(e,i(t)):e},Rg=jd,Pg=Eg,Bg=rc,Ig=Mu,Dg=ac,Lg=Wc,Og=/#|\.prototype\./,Fg=function(t,e){var i=Hg[zg(t)];return i==Ng||i!=jg&&(Lg(e)?Dg(e):!!e)},zg=Fg.normalize=function(t){return String(t).replace(Og,".").toLowerCase()},Hg=Fg.data={},jg=Fg.NATIVE="N",Ng=Fg.POLYFILL="P",Vg=Fg,Wg=sc,Ug=rc.f,Gg=Gu,Yg=Kp,$g=Ed,Xg=function(t,e,i){for(var n=Pg(e),s=Ig.f,r=Bg.f,a=0;ar;r++)if((o=y(t[r]))&&wm(Em,o))return o;return new Tm(!1)}n=Am(t,s)}for(l=u?t.next:n.next;!(h=_m(l,n)).done;){try{o=y(h.value)}catch(t){Mm(n,"throw",t)}if("object"==typeof o&&o&&wm(Em,o))return o}return new Tm(!1)},Pm=qc,Bm=TypeError,Im=function(t,e){if(Pm(e,t))return t;throw Bm("Incorrect invocation")},Dm=tu("iterator"),Lm=!1;try{var Om=0,Fm={next:function(){return{done:!!Om++}},return:function(){Lm=!0}};Fm[Dm]=function(){return this},Array.from(Fm,(function(){throw 2}))}catch(hl){}var zm=Mu.f,Hm=jd,jm=tu("toStringTag"),Nm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Hm(t,jm)&&zm(t,jm,{configurable:!0,value:e})},Vm=wc,Wm=_d,Um=Wc,Gm=String,Ym=TypeError,$m=function(t,e,i){try{return Vm(Wm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Xm=Pu,Km=function(t){if("object"==typeof t||Um(t))return t;throw Ym("Can't set "+Gm(t)+" as a prototype")},qm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=$m(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Xm(i),Km(n),e?t(i,n):i.__proto__=n,i}}():void 0),Zm=Wc,Jm=Yc,Qm=qm,ty=qg,ey=sc,iy=wc,ny=Vg,sy=Kp,ry=Of,ay=Rm,oy=Im,ly=Wc,hy=Ic,cy=Yc,dy=ac,uy=function(t,e){if(!e&&!Lm)return!1;var i=!1;try{var n={};n[Dm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},py=Nm,gy=function(t,e,i){var n,s;return Qm&&Zm(n=e.constructor)&&n!==i&&Jm(s=n.prototype)&&s!==i.prototype&&Qm(t,s),t},fy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=ey[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=iy(o[t]);sy(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!cy(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!cy(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!cy(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ny(t,!ly(a)||!(s||o.forEach&&!dy((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),ry.enable();else if(ny(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=dy((function(){d.has(1)})),g=uy((function(t){new a(t)})),f=!s&&dy((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){oy(t,o);var i=gy(new a,t,l);return hy(e)||ay(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,ty({global:!0,constructor:!0,forced:l!=a},h),py(l,t),s||i.setStrong(l,t,n),l},my={},yy=vg,_y=bg,vy=Object.keys||function(t){return yy(t,_y)},by=oc,xy=Cu,Sy=Mu,wy=Pu,Ay=Hc,ky=vy;my.f=by&&!xy?Object.defineProperties:function(t,e){wy(t);for(var i,n=Ay(e),s=ky(e),r=s.length,a=0;r>a;)Sy.f(t,i=s[a++],n[i]);return t};var My,Cy=Kc("document","documentElement"),Ty=Pu,Ey=my,Ry=bg,Py=up,By=Cy,Iy=gu,Dy="prototype",Ly="script",Oy=dp("IE_PROTO"),Fy=function(){},zy=function(t){return"<"+Ly+">"+t+""},Hy=function(t){t.write(zy("")),t.close();var e=t.parentWindow.Object;return t=null,e},jy=function(){try{My=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;jy="undefined"!=typeof document?document.domain&&My?Hy(My):(e=Iy("iframe"),i="java"+Ly+":",e.style.display="none",By.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(zy("document.F=Object")),t.close(),t.F):Hy(My);for(var n=Ry.length;n--;)delete jy[Dy][Ry[n]];return jy()};Py[Oy]=!0;var Ny,Vy,Wy,Uy=Object.create||function(t,e){var i;return null!==t?(Fy[Dy]=Ty(t),i=new Fy,Fy[Dy]=null,i[Oy]=t):i=jy(),void 0===e?i:Ey.f(i,e)},Gy=Up,Yy=Mu,$y=function(t,e,i){return i.get&&Gy(i.get,e,{getter:!0}),i.set&&Gy(i.set,e,{setter:!0}),Yy.f(t,e,i)},Xy=Kp,Ky=function(t,e,i){for(var n in e)Xy(t,n,e[n],i);return t},qy=!ac((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Zy=jd,Jy=Wc,Qy=Fd,t_=qy,e_=dp("IE_PROTO"),i_=Object,n_=i_.prototype,s_=t_?i_.getPrototypeOf:function(t){var e=Qy(t);if(Zy(e,e_))return e[e_];var i=e.constructor;return Jy(i)&&e instanceof i?i.prototype:e instanceof i_?n_:null},r_=ac,a_=Wc,o_=Yc,l_=s_,h_=Kp,c_=tu("iterator"),d_=!1;[].keys&&("next"in(Wy=[].keys())?(Vy=l_(l_(Wy)))!==Object.prototype&&(Ny=Vy):d_=!0);var u_=!o_(Ny)||r_((function(){var t={};return Ny[c_].call(t)!==t}));u_&&(Ny={}),a_(Ny[c_])||h_(Ny,c_,(function(){return this}));var p_={IteratorPrototype:Ny,BUGGY_SAFARI_ITERATORS:d_},g_=p_.IteratorPrototype,f_=Uy,m_=_c,y_=Nm,__=Uf,v_=function(){return this},b_=qg,x_=dc,S_=Wc,w_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=f_(g_,{next:m_(+!n,i)}),y_(t,s,!1),__[s]=v_,t},A_=s_,k_=qm,M_=Nm,C_=Gu,T_=Kp,E_=Uf,R_=Ju.PROPER,P_=Ju.CONFIGURABLE,B_=p_.IteratorPrototype,I_=p_.BUGGY_SAFARI_ITERATORS,D_=tu("iterator"),L_="keys",O_="values",F_="entries",z_=function(){return this},H_=Kc,j_=$y,N_=oc,V_=tu("species"),W_=Uy,U_=$y,G_=Ky,Y_=Wf,$_=Im,X_=Ic,K_=Rm,q_=function(t,e,i,n,s,r,a){w_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!I_&&t in p)return p[t];switch(t){case L_:case O_:case F_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[D_]||p["@@iterator"]||s&&p[s],f=!I_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=A_(m.call(new t)))!==Object.prototype&&o.next&&(A_(o)!==B_&&(k_?k_(o,B_):S_(o[D_])||T_(o,D_,z_)),M_(o,d,!0)),R_&&s==O_&&g&&g.name!==O_&&(P_?C_(p,"name",O_):(u=!0,f=function(){return x_(g,this)})),s)if(l={values:c(O_),keys:r?f:c(L_),entries:c(F_)},a)for(h in l)(I_||u||!(h in p))&&T_(p,h,l[h]);else b_({target:e,proto:!0,forced:I_||u},l);return p[D_]!==f&&T_(p,D_,f,{name:s}),E_[e]=f,l},Z_=function(t,e){return{value:t,done:e}},J_=function(t){var e=H_(t);N_&&e&&!e[V_]&&j_(e,V_,{configurable:!0,get:function(){return this}})},Q_=oc,tv=Of.fastKey,ev=Mp.set,iv=Mp.getterFor,nv={getConstructor:function(t,e,i,n){var s=t((function(t,s){$_(t,r),ev(t,{type:e,index:W_(null),first:void 0,last:void 0,size:0}),Q_||(t.size=0),X_(s)||K_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=iv(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=tv(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),Q_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=tv(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return G_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,Q_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),Q_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=Y_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),G_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),Q_&&U_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=iv(e),r=iv(n);q_(t,e,(function(t,e){ev(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?Z_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,Z_(void 0,!0))}),i?"entries":"values",!i,!0),J_(e)}};fy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),nv);var sv=Cc,rv=Array.isArray||function(t){return"Array"==sv(t)},av=wc,ov=ac,lv=Wc,hv=em,cv=rp,dv=function(){},uv=[],pv=Kc("Reflect","construct"),gv=/^\s*(?:class|function)\b/,fv=av(gv.exec),mv=!gv.exec(dv),yv=function(t){if(!lv(t))return!1;try{return pv(dv,uv,t),!0}catch(t){return!1}},_v=function(t){if(!lv(t))return!1;switch(hv(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return mv||!!fv(gv,cv(t))}catch(t){return!0}};_v.sham=!0;var vv=!pv||ov((function(){var t;return yv(yv.call)||!yv(Object)||!yv((function(){t=!0}))||t}))?_v:yv,bv=rv,xv=vv,Sv=Yc,wv=tu("species"),Av=Array,kv=function(t){var e;return bv(t)&&(e=t.constructor,(xv(e)&&(e===Av||bv(e.prototype))||Sv(e)&&null===(e=e[wv]))&&(e=void 0)),void 0===e?Av:e},Mv=Wf,Cv=Bc,Tv=Fd,Ev=lg,Rv=function(t,e){return new(kv(t))(0===e?0:e)},Pv=wc([].push),Bv=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=Tv(l),f=Cv(g),m=Mv(h,c),y=Ev(f),_=0,v=d||Rv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Pv(b,u)}else switch(t){case 4:return!1;case 7:Pv(b,u)}return r?-1:n||s?s:b}},Iv={forEach:Bv(0),map:Bv(1),filter:Bv(2),some:Bv(3),every:Bv(4),find:Bv(5),findIndex:Bv(6),filterReject:Bv(7)},Dv=wc,Lv=Ky,Ov=Of.getWeakData,Fv=Im,zv=Pu,Hv=Ic,jv=Yc,Nv=Rm,Vv=jd,Wv=Mp.set,Uv=Mp.getterFor,Gv=Iv.find,Yv=Iv.findIndex,$v=Dv([].splice),Xv=0,Kv=function(t){return t.frozen||(t.frozen=new qv)},qv=function(){this.entries=[]},Zv=function(t,e){return Gv(t.entries,(function(t){return t[0]===e}))};qv.prototype={get:function(t){var e=Zv(this,t);if(e)return e[1]},has:function(t){return!!Zv(this,t)},set:function(t,e){var i=Zv(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Yv(this.entries,(function(e){return e[0]===t}));return~e&&$v(this.entries,e,1),!!~e}};var Jv,Qv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Fv(t,r),Wv(t,{type:e,id:Xv++,frozen:void 0}),Hv(s)||Nv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Uv(e),o=function(t,e,i){var n=a(t),s=Ov(zv(e),!0);return!0===s?Kv(n).set(e,i):s[n.id]=i,t};return Lv(r,{delete:function(t){var e=a(this);if(!jv(t))return!1;var i=Ov(t);return!0===i?Kv(e).delete(t):i&&Vv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!jv(t))return!1;var i=Ov(t);return!0===i?Kv(e).has(t):i&&Vv(i,e.id)}}),Lv(r,i?{get:function(t){var e=a(this);if(jv(t)){var i=Ov(t);return!0===i?Kv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},tb=bf,eb=sc,ib=wc,nb=Ky,sb=Of,rb=fy,ab=Qv,ob=Yc,lb=Mp.enforce,hb=ac,cb=lp,db=Object,ub=Array.isArray,pb=db.isExtensible,gb=db.isFrozen,fb=db.isSealed,mb=db.freeze,yb=db.seal,_b={},vb={},bb=!eb.ActiveXObject&&"ActiveXObject"in eb,xb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Sb=rb("WeakMap",xb,ab),wb=Sb.prototype,Ab=ib(wb.set);if(cb)if(bb){Jv=ab.getConstructor(xb,"WeakMap",!0),sb.enable();var kb=ib(wb.delete),Mb=ib(wb.has),Cb=ib(wb.get);nb(wb,{delete:function(t){if(ob(t)&&!pb(t)){var e=lb(this);return e.frozen||(e.frozen=new Jv),kb(this,t)||e.frozen.delete(t)}return kb(this,t)},has:function(t){if(ob(t)&&!pb(t)){var e=lb(this);return e.frozen||(e.frozen=new Jv),Mb(this,t)||e.frozen.has(t)}return Mb(this,t)},get:function(t){if(ob(t)&&!pb(t)){var e=lb(this);return e.frozen||(e.frozen=new Jv),Mb(this,t)?Cb(this,t):e.frozen.get(t)}return Cb(this,t)},set:function(t,e){if(ob(t)&&!pb(t)){var i=lb(this);i.frozen||(i.frozen=new Jv),Mb(this,t)?Ab(this,t,e):i.frozen.set(t,e)}else Ab(this,t,e);return this}})}else tb&&hb((function(){var t=mb([]);return Ab(new Sb,t,1),!gb(t)}))&&nb(wb,{set:function(t,e){var i;return ub(t)&&(gb(t)?i=_b:fb(t)&&(i=vb)),Ab(this,t,e),i==_b&&mb(t),i==vb&&yb(t),this}});var Tb=Kc,Eb=wc,Rb=Dd,Pb=Tb("Map"),Bb=Tb("WeakMap"),Ib=Eb([].push),Db=Rb("metadata"),Lb=Db.store||(Db.store=new Bb),Ob=function(t,e,i){var n=Lb.get(t);if(!n){if(!i)return;Lb.set(t,n=new Pb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Pb)}return s},Fb={store:Lb,getMap:Ob,has:function(t,e,i){var n=Ob(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Ob(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Ob(i,n,!0).set(t,e)},keys:function(t,e){var i=Ob(t,e,!1),n=[];return i&&i.forEach((function(t,e){Ib(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},zb=Pu,Hb=Fb.toKey,jb=Fb.set;qg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Hb(arguments[3]);jb(t,e,zb(i),n)}});var Nb=Pu,Vb=Fb.toKey,Wb=Fb.getMap,Ub=Fb.store;qg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Vb(arguments[2]),n=Wb(Nb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=Ub.get(e);return s.delete(i),!!s.size||Ub.delete(e)}});var Gb=Pu,Yb=s_,$b=Fb.has,Xb=Fb.get,Kb=Fb.toKey,qb=function(t,e,i){if($b(t,e,i))return Xb(t,e,i);var n=Yb(e);return null!==n?qb(t,n,i):void 0};qg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Kb(arguments[2]);return qb(t,Gb(e),i)}});var Zb=wc,Jb=Map.prototype,Qb={Map:Map,set:Zb(Jb.set),get:Zb(Jb.get),has:Zb(Jb.has),remove:Zb(Jb.delete),proto:Jb},tx=dc,ex=wc,ix=function(t,e,i){for(var n,s,r=i||t.next;!(n=tx(r,t)).done;)if(void 0!==(s=e(n.value)))return s},nx=Qb.Map,sx=Qb.proto,rx=ex(sx.forEach),ax=ex(sx.entries),ox=ax(new nx).next,lx=_d,hx=Ic,cx=lg,dx=Fd,ux=function(t,e,i){return i?ix(ax(t),(function(t){return e(t[1],t[0])}),ox):rx(t,e)},px=Qb.Map,gx=Qb.has,fx=Qb.set,mx=wc([].push),yx=qg,_x=wc,vx=Fb,bx=Pu,xx=s_,Sx=function(t){var e,i,n,s=dx(this),r=cx(s),a=[],o=new px,l=hx(t)?function(t){return t}:lx(t);for(e=0;e= than the number of constructor arguments of its base class."},bS=function(t,e){return"@postConstruct error in class "+t+": "+e},xS=function(t,e){return"@preDestroy error in class "+t+": "+e},SS=function(t,e){return"onDeactivation() error in class "+t+": "+e},wS="Maximum call stack size exceeded",AS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(tS,t),userGeneratedMetadata:Reflect.getMetadata(Jx,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(Qx,t)||[]},t}(),kS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function MS(t){return t instanceof RangeError||t.message===wS}function CS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function TS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=PS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function ES(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||ES(t.parentRequest,e))}function RS(t){t.childRequests.forEach((function(t){if(ES(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=CS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(yS+" "+e)}RS(t)}))}function PS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var BS=function(){function t(t){this.id=lS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),IS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Yx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),DS=function(t,e){this.parentContext=t,this.rootRequest=e},LS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),OS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),FS=function(){function t(t,e,i,n){this.id=lS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new OS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new IS(Yx,n):n instanceof IS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:WS(t,i)}return 0}function US(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[qx],multiInject:e[Zx],targetName:e[$x],unmanaged:e[Xx]}}var GS=function(){function t(t,e,i,n,s){this.id=lS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function YS(t){return t._bindingDictionary}function $S(t,e,i,n,s){var r=KS(i.container,s.serviceIdentifier),a=[];return r.length===kS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=KS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new GS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case kS.NoBindingsAvailable:if(i.isOptional())return e;var s=CS(t),r=gS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=TS(n,s,KS),new Error(r);case kS.OnlyOneBindingAvailable:return e;case kS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=CS(t),r=pS+" "+s;throw r+=TS(n,s,KS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function XS(t,e,i,n,s,r){var a,o;if(null===s){a=$S(t,e,n,null,r),o=new GS(i,n,null,a,r);var l=new DS(n,o);n.addPlan(l)}else a=$S(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===rS.Instance&&null!==e.implementationType){var s=function(t,e){return HS(t,PS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=WS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===aS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=JS(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=rw(rw({},s),{constr:t});n=s.isAsync?function(t){return aw(this,void 0,void 0,(function(){var e,i;return ow(this,(function(n){switch(n.label){case 0:return[4,dw(t.constructorInjections)];case 1:return e=n.sent(),[4,dw(t.propertyInjections)];case 2:return i=n.sent(),[2,cw(rw(rw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):cw(r)}else n=new t;return n}function cw(t){var e,i=new((e=t.constr).bind.apply(e,lw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function dw(t){return aw(this,void 0,void 0,(function(){var e,i,n,s;return ow(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Hw=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new zw,onDeactivations:new zw}},t}(),jw=function(){return jw=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new rA(e,i)})).inSingletonScope().whenTargetNamed(e)}class oA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class lA extends oA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const hA=Symbol.for("EnvContribution"),cA=Symbol.for("Global");var dA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,n){e(i,n,t)}};let gA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new lA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};gA=dA([qw(),pA(0,Qw(sA)),pA(0,Zw(hA)),uA("design:paramtypes",[Object])],gA);const fA=cs-1e-8;class mA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>fA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=cs)<0&&(n+=cs),(s%=cs)<0&&(s+=cs),ss;++o,a-=hs)g(a);else for(a=n-n%hs+hs,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const _A=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,vA={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},bA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let xA,SA,wA,AA,kA,MA;var CA,TA,EA,RA,PA,BA,IA,DA,LA;function OA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function FA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Es(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=cs:T>0&&0===r&&(T-=cs);const E=Math.ceil(Math.abs(T/(hs+.001))),R=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function jA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class qA extends KA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function ZA(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class JA{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function QA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new KA("linear",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new JA(s,n),t),s}function tk(t,e,i,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n)}class ek{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&tk(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:tk(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ik(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return QA(t,e);const s=new KA("basis",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new ek(s,n),t),s}function nk(t){return t<0?-1:1}function sk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(nk(r)+nk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function rk(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function ak(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class ok{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined2);break;case 3:ak(this,this._t0,rk(this,this._t0),!1!==this._lastDefined2)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,ak(this,rk(this,e=sk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:ak(this,this._t0,e=sk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined}}tryUpdateLength(){return this.context.tryUpdateLength()}}class lk extends ok{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function hk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return QA(t,e);const s=new KA("monotoneX",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new ok(s,n),t),s}function ck(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return QA(t,e);const s=new qA("monotoneY",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new lk(s,n),t),s}let dk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function uk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new KA("step",null!=n?n:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new dk(r,e,s),t),r}class pk{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){this.context.closePath()}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function gk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new KA("linear",null!=i?i:us(t[t.length-1].x-t[0].x)>us(t[t.length-1].y-t[0].y)?IA.ROW:IA.COLUMN);return function(t,e){ZA(t,e)}(new pk(s,n),t),s}function fk(t,e,i){switch(e){case"linear":default:return QA(t,i);case"basis":return ik(t,i);case"monotoneX":return hk(t,i);case"monotoneY":return ck(t,i);case"step":return uk(t,.5,i);case"stepBefore":return uk(t,0,i);case"stepAfter":return uk(t,1,i);case"linearClosed":return gk(t,i)}}class mk extends yA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new mA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([bA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([bA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([bA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([bA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([bA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([bA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([bA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([bA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([bA.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const t=[];t[bA.M]=t=>`M${t[1]} ${t[2]}`,t[bA.L]=t=>`L${t[1]} ${t[2]}`,t[bA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[bA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[bA.A]=t=>{const e=[];zA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tMA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),jA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===IA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return us(t.p0.y-e.p1.y)}if(this.direction===IA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return us(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const yk=["l",0,0,0,0,0,0,0];function _k(t,e,i){const n=yk[0]=t[0];if("a"===n||"A"===n)yk[1]=e*t[1],yk[2]=i*t[2],yk[3]=t[3],yk[4]=t[4],yk[5]=t[5],yk[6]=e*t[6],yk[7]=i*t[7];else if("h"===n||"H"===n)yk[1]=e*t[1];else if("v"===n||"V"===n)yk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Ik=Object.assign(Object.assign({},kk),{points:[],cornerRadius:0}),Dk=Object.assign(Object.assign({},kk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Lk=Object.assign(Object.assign({},kk),{width:0,height:0,cornerRadius:0,length:0}),Ok=Object.assign(Object.assign({},kk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Fk=Object.assign(Object.assign(Object.assign({},kk),wk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),zk=Object.assign(Object.assign({},kk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Hk=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},kk),{fill:!0}),jk=Object.assign(Object.assign({},Hk),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});var Nk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Fk.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};Vk=Nk([qw()],Vk);var Wk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Uk=Symbol.for("TextMeasureContribution");let Gk=class extends Vk{};Gk=Wk([qw()],Gk);const Yk=new Uw;const $k=new class{},Xk=Symbol.for("CanvasFactory"),Kk=Symbol.for("Context2dFactory");function qk(t){return Yk.getNamed(Xk,$k.global.env)(t)}const Zk=1e-4,Jk=Math.sqrt(3),Qk=1/3;function tM(t){return t>-gM&&tgM||t<-gM}const iM=[0,0],nM=[0,0],sM=[0,0];function rM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function aM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function oM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function lM(t){return(t%=ds)<0&&(t+=ds),t}function hM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function cM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=ds);let d=Math.atan2(l,o);return d<0&&(d+=ds),d>=n&&d<=s||d+ds>=n&&d+ds<=s}function pM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(tM(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const mM=[-1,-1,-1],yM=[-1,-1];function _M(){const t=yM[0];yM[0]=yM[1],yM[1]=t}function vM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(tM(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Qk):Math.pow(i,Qk),n=n<0?-Math.pow(-n,Qk):Math.pow(n,Qk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Jk*Math.sin(e)))/(3*a),h=(-o+i*(n-Jk*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,mM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&_M(),p=oM(e,n,r,o,yM[0]),u>1&&(g=oM(e,n,r,o,yM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(tM(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,mM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=aM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);mM[0]=-l,mM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=ds-1e-4){n=0,s=ds;const e=r?1:-1;return a>=mM[0]+t&&a<=mM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=ds,s+=ds);let c=0;for(let e=0;e<2;e++){const i=mM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=ds+t),(t>=n&&t<=s||t+ds>=n&&t+ds<=s)&&(t>ls/2&&t<1.5*ls&&(e=-e),c+=e)}}return c}function SM(t){return Math.round(t/ls*1e8)/1e8%2*ls}function wM(t,e){let i=SM(t[0]);i<0&&(i+=ds);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=ds?s=i+ds:e&&i-s>=ds?s=i-ds:!e&&i>s?s=i+(ds-SM(i-s)):e&&i1&&(i||(h+=hM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;AM[0]=S,AM[1]=w,wM(AM,Boolean(a[6])),S=AM[0],w=AM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case bA.M:u=m,p=y,c=u,d=p;break;case bA.L:if(i){if(pM(c,d,m,y,e,n,s))return!0}else h+=hM(c,d,m,y,n,s)||0;c=m,d=y;break;case bA.C:if(i){if(dM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=vM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case bA.Q:if(i){if(cM(c,d,m,y,_,v,e,n,s))return!0}else h+=bM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case bA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=hM(c,d,o,l,n,s),i){if(uM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=xM(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case bA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(pM(u,p,o,p,e,n,s)||pM(o,p,o,l,e,n,s)||pM(o,l,u,l,e,n,s)||pM(u,l,u,p,e,n,s))return!0}else h+=hM(o,p,o,l,n,s),h+=hM(u,l,u,p,n,s);break;case bA.Z:if(i){if(pM(c,d,u,p,e,n,s))return!0}else h+=hM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TM=function(t,e){return function(i,n){e(i,n,t)}};let EM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=qk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:wk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new wr(Object.assign({defaultFontParams:{fontFamily:wk.fontFamily,fontSize:wk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+wr.ALPHABET_CHAR_SET+wr.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var RM;EM=MM([qw(),TM(0,Qw(sA)),TM(0,Zw(Uk)),TM(1,Qw(cA)),CM("design:paramtypes",[Object,Object])],EM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(RM||(RM={}));const PM=new Ls;let BM=class{constructor(){this.matrix=new Ls}init(t){return this.mode=RM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=RM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(PM.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(PM.a,PM.b,PM.c,PM.d,PM.e,PM.f),this}scale(t,e,i){return this.mode===RM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return PM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(PM.a,PM.b,PM.c,PM.d,PM.e,PM.f),this}translate(t,e){return this.mode===RM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===RM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};BM=MM([qw(),CM("design:paramtypes",[])],BM);const IM={arc:Mk,area:Ck,circle:Tk,line:Pk,path:Bk,symbol:Ok,text:Fk,rect:Dk,rect3d:Lk,polygon:Ik,richtext:zk,richtextIcon:jk,image:Hk,group:Ek,glyph:Rk},DM=Object.keys(IM);function LM(){return{arc:Object.assign({},IM.arc),area:Object.assign({},IM.area),circle:Object.assign({},IM.circle),line:Object.assign({},IM.line),path:Object.assign({},IM.path),symbol:Object.assign({},IM.symbol),text:Object.assign({},IM.text),rect:Object.assign({},IM.rect),rect3d:Object.assign({},IM.rect3d),polygon:Object.assign({},IM.polygon),richtext:Object.assign({},IM.richtext),richtextIcon:Object.assign({},IM.richtextIcon),image:Object.assign({},IM.image),group:Object.assign({},IM.group),glyph:Object.assign({},IM.glyph)}}function OM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const FM=new Array(60).fill(0).map((()=>LM()));class zM{constructor(){this._defaultTheme=FM.pop()||LM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?OM(this.userTheme,t.userTheme,!1):this.userTheme=mn(t.userTheme),OM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);DM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const HM=new zM;function jM(t,e){return t.glyphHost?jM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):HM.getTheme()}return null}(t)||HM.getTheme()}class NM{static GenAutoIncrementId(){return NM.auto_increment_id++}}NM.auto_increment_id=0;var VM=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class WM extends Ui{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=NM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return VM(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(qM(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=qM(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=qM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=qM(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=KM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(qM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(qM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,qM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof YM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):qM(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof $M))return void console.warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i=0&&t<=pn(this.rootTarget,"width")&&e>=0&&e<=pn(this.rootTarget,"height")?this.rootTarget:null,i}}const JM={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof UM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new XM(t,e))}},QM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class tC{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new ZM(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new YM,this.rootWheelEvent=new $M,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&tn(t)&&!fn(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class eC{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const iC=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},nC=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class sC extends Ui{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=KM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=KM.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||iC(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=nC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=KM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=nC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=iC(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=KM.now()-i>this.config.press.time&&nC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class aC{static Avaliable(){return!0}avaliable(){return aC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class oC{static Avaliable(){return!!$k.global.getRequestAnimationFrame()}avaliable(){return oC.Avaliable()}tick(t,e){$k.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var lC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(lC||(lC={}));class hC{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-hC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*hC.bounceIn(2*t):.5*hC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/ds*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*ds/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/ds*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*ds/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/ds*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*ds/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*ds/e)*.5+1}}}hC.quadIn=hC.getPowIn(2),hC.quadOut=hC.getPowOut(2),hC.quadInOut=hC.getPowInOut(2),hC.cubicIn=hC.getPowIn(3),hC.cubicOut=hC.getPowOut(3),hC.cubicInOut=hC.getPowInOut(3),hC.quartIn=hC.getPowIn(4),hC.quartOut=hC.getPowOut(4),hC.quartInOut=hC.getPowInOut(4),hC.quintIn=hC.getPowIn(5),hC.quintOut=hC.getPowOut(5),hC.quintInOut=hC.getPowInOut(5),hC.backIn=hC.getBackIn(1.7),hC.backOut=hC.getBackOut(1.7),hC.backInOut=hC.getBackInOut(1.7),hC.elasticIn=hC.getElasticIn(1,.3),hC.elasticOut=hC.getElasticOut(1,.3),hC.elasticInOut=hC.getElasticInOut(1,.3*1.5);const cC=new class{constructor(){this.id=NM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===RA.END?this.removeAnimate(e):e.status===RA.RUNNING||e.status===RA.INITIAL?(this.animateCount++,e.advance(t)):e.status===RA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class dC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class uC extends dC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let pC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cC;this.id=t,this.timeline=e,this.status=RA.INITIAL,this.tailAnimate=new gC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=fs(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&PA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:EA.ANIMATE_PLAY})}runCb(t){const e=new uC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===RA.RUNNING&&(this.status=RA.PAUSED)}resume(){this.status===RA.PAUSED&&(this.status=RA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new gC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===RA.RUNNING&&(this.status=RA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=RA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};pC.mode=PA.NORMAL,pC.interpolateMap=new Map;class gC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new fC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?hC[i]:i,s=this._addStep(e,null,n);return s.type=BA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?hC[i]:i,r=this._addStep(e,null,s);return r.type=BA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=BA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=BA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new fC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class fC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const mC=200,yC="cubicOut",_C=1e3,vC="quadInOut";var bC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(bC||(bC={}));const xC=[!1,!1,!1,!1],SC=[0,0,0,0],wC=t=>t?en(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(SC[0]=t[0],SC[2]=t[0],SC[1]=t[1],SC[3]=t[1],SC):t:t:0,AC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],kC=[1,2,3,0,1,2,3,0];function MC(t,e,i,n){for(;t>=ds;)t-=ds;for(;t<0;)t+=ds;for(;t>e;)e+=ds;AC[0].x=i,AC[1].y=i,AC[2].x=-i,AC[3].y=-i;const s=Math.ceil(t/hs)%4,r=Math.ceil(e/hs)%4;if(n.add(gs(t)*i,ys(t)*i),n.add(gs(e)*i,ys(e)*i),s!==r||e-t>ls){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new As(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new As(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new As(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=CC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class DC extends dC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:EA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:EA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:EA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class LC extends DC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=$k.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class OC extends DC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=$k.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class FC extends dC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=ds-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+ls/2;i.alpha>ds;)i.alpha-=ds;i.alpha=ds-i.alpha,i.zIndex=-1e4*i.z}}class zC extends dC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class HC extends dC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?hC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function jC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function NC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{Un(e,n)&&Un(i,s)||t.push(e,i,n,s,n,s)};function $C(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function XC(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&rn(t.x)&&rn(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),QC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},tT=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Cs;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return QC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return QC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);tT(s[0],n,i),tT(s[1],e-n,i)}};var eT={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const iT={};for(const t in eT)fn(eT,t)&&(iT[eT[t]]=t);const nT={to:{},get:{}};function sT(t,e,i){return Math.min(Math.max(e,t),i)}function rT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}nT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=nT.get.hsl(t,n),i="hsl";break;case"hwb":e=nT.get.hwb(t,n),i="hwb";break;default:e=nT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},nT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=eT[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=sT(e[n],0,255);return e[3]=sT(e[3],0,1),e},nT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=sT(parseFloat(i[2]),0,100),e[2]=sT(parseFloat(i[3]),0,100),e[3]=sT(isNaN(t)?1:t,0,1),e}return null},nT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=sT(parseFloat(i[2]),0,100),e[2]=sT(parseFloat(i[3]),0,100),e[3]=sT(isNaN(t)?1:t,0,1),e}return null},nT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},nT.to.keyword=function(t){return iT[t.slice(0,3)]};const aT=nT;var oT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(oT||(oT={}));class lT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===oT.Color1){let e=lT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=nT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];lT.store1[t]=s,lT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=lT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=nT.get(t),n&&n.value){const e=n.value;lT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],lT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===oT.Color1){if(lT.store1[t])return;lT.store1[t]=i,lT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(lT.store255[t])return;lT.store255[t]=i,lT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function hT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function cT(t,e,i,n,s){if(!t||!e)return t&&hT(t)||e&&hT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=lT.Get(t,oT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=lT.Get(e,oT.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:hT(a)})))});return o?cT(r,l,i,n,s):cT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:pT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:pT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:pT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),hT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}lT.store255={},lT.store1={};const dT=[0,0,0,0],uT=[0,0,0,0];function pT(t,e,i){return lT.Get(t,oT.Color255,dT),lT.Get(e,oT.Color255,uT),`rgba(${Math.round(dT[0]+(uT[0]-dT[0])*i)},${Math.round(dT[1]+(uT[1]-dT[1])*i)},${Math.round(dT[2]+(uT[2]-dT[2])*i)},${dT[3]+(uT[3]-dT[3])*i})`}const gT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=cT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},fT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?$C(t):[],s=$C(e);i&&n&&(i.fromTransform&&XC(n,i.fromTransform.clone().getInverse()),XC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},yT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],_T=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!yT.includes(s))return;const r=e[s];Xi(r)||Xi(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?lT.Get(t[s],oT.Color255):t[s],to:"string"==typeof r?lT.Get(r,oT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class vT extends dC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;fT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&gT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const bT=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=mT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=_T(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new vT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:_C,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:vC)),c};class xT extends dC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;fT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&gT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ST=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>EC.includes(t))(i)||(e[i]=t[i])})),e},wT=(t,e,i)=>{const n=ST(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=$k.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},AT=(t,e,i)=>{const n=[],s=i?null:ST(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:ST(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=qC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push($k.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=qC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push($k.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=qC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push($k.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return ZC(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ZC(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push($k.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:JC(i)}];const n=[];return tT(i,e,n),n})(t,e).forEach((t=>{n.push($k.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&rn(t.x)&&rn(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return tT(r,e,h),h})(t,e).forEach((t=>{n.push($k.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=$C(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push($k.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push($k.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&wT(t,n,e),n};class MT{static GetImage(t,e){var i;let n=MT.cache.get(t);n?"fail"===n.loadState?$k.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&$k.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},MT.cache.set(t,n),n.dataPromise=$k.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=MT.cache.get(t);n?"fail"===n.loadState?$k.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&$k.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},MT.cache.set(t,n),n.dataPromise=$k.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=MT.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},MT.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=$k.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=$k.global.loadBlob(t):"json"===e&&(i.dataPromise=$k.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}MT.cache=new Map;const CT=new Ls,TT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],ET=["x","y"],RT=["scaleX","scaleY"],PT=["angle"],BT=new As;class IT extends WM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Ts,this._updateTag=CA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=jM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;BT.x=i+e,BT.y=n+s}else BT.x=i,BT.y=n;return BT}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;$k.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return $k.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Ls),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&CA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&CA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&CA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&CA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&CA.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&CA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=CA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===TA.GLOBAL){const i=new As(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){$k.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!Xi(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:mC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:yC)}else this.setAttributes(t,!1,{type:EA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();fn(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=CA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=CA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=CA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&CA.UPDATE_SHAPE_AND_BOUNDS)===CA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=CA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=CA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=CA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=CA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=CA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=vk.x,y:e=vk.y,scaleX:i=vk.scaleX,scaleY:n=vk.scaleY,angle:s=vk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=gs(a),f=ys(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(vk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=CT.setValue(a.a,a.b,a.c,a.d,a.e,a.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),$k.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:EA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:EA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=cT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=cT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=cT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return jM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:$k.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return tn(t,!0)?this.pathProxy=(new mk).fromString(t):this.pathProxy=new mk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",on(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(MT.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new XM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}IT.mixin(JM);var DT=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function LT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let OT=0;function FT(){return OT++}const zT=FT(),HT=FT(),jT=FT(),NT=FT(),VT=FT(),WT=FT(),UT=FT(),GT=FT(),YT=FT(),$T=FT(),XT=FT(),KT=FT(),qT=FT(),ZT=FT(),JT=FT(),QT=FT(),tE=Symbol.for("GraphicService"),eE=Symbol.for("GraphicCreator");var iE;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(iE||(iE={}));let nE=class t extends IT{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=WT,this._childUpdateTag=CA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new zM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new zM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===TA.GLOBAL){const i=new As(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&CA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;$k.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return $k.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=jM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=$k.graphicService.updateGroupAABBBounds(t,jM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=wC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=CA.CLEAR_BOUNDS,this._childUpdateTag&=CA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=CA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&CA.UPDATE_BOUNDS||(this._childUpdateTag|=CA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),$k.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),$k.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,$k.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{$k.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),$k.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&CA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=$k.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const sE=Symbol.for("LayerHandlerContribution");class rE extends nE{get offscreen(){return this.layerHandler.offscreen}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=Yk.get(sE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new zM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{$k.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{$k.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var aE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lE=function(t,e){return function(i,n){e(i,n,t)}};let hE=class{constructor(t){this.global=t,this.layerMap=new Map,this.staticLayerCountInEnv=t.getStaticCanvasCount(),this.dynamicLayerCountInEnv=t.getDynamicCanvasCount()}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};const i=new rE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}};hE=aE([qw(),lE(0,Qw(cA)),oE("design:paramtypes",[Object])],hE);var cE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uE=function(t,e){return function(i,n){e(i,n,t)}};const pE=Symbol.for("Window"),gE=Symbol.for("WindowHandlerContribution");let fE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new lA(["x","y","width","height"])},this._uid=NM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Yk.getNamed(gE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};cE([nA(),dE("design:type",Function),dE("design:paramtypes",[]),dE("design:returntype",void 0)],fE.prototype,"postInit",null),fE=cE([qw(),uE(0,Qw(cA)),dE("design:paramtypes",[Object])],fE);const mE=Symbol.for("TransformUtil"),yE=Symbol.for("GraphicUtil"),_E=Symbol.for("LayerService");var vE=new Gw((t=>{t(gA).toSelf().inSingletonScope(),t(cA).toService(gA),t(fE).to(fE),t(pE).toService(fE),t(EM).toSelf().inSingletonScope(),t(yE).toService(EM),t(BM).toSelf().inSingletonScope(),t(mE).toService(BM),t(hE).toSelf().inSingletonScope(),t(_E).toService(hE)}));function bE(t){return!!t}function xE(t,e){let i;return i=en(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function SE(t,e){return t*e>0}function wE(t,e,i,n){return t*e>0&&i>0&&n>0}function AE(t,e){return t*e>0}function kE(t,e,i,n){return t*e>0&&i>0&&n>0}function ME(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=jM(t,null==r?void 0:r.theme)[t.type],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible}=t.attribute,m=SE(d,u),y=AE(d,g),_=bE(h),v=xE(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return jA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function CE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uR*R+P*P&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function EE(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=us(l-o),c=l>o;let d=!1;if(s=ds-os)e.moveTo(i+s*gs(o),n+s*ys(o)),e.arc(i,n,s,o,l,!c),r>os&&(e.moveTo(i+r*gs(l),n+r*ys(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*gs(f),T=s*ys(f),E=r*gs(y),R=r*ys(y);let P,B,I,D;if((A>os||w>os)&&(P=s*gs(m),B=s*ys(m),I=r*gs(_),D=r*ys(_),hos){const t=ms(v,k),r=ms(b,k),o=TE(I,D,C,T,s,t,Number(c)),l=TE(P,B,E,R,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,ps(o.y01,o.x01),ps(o.y11,o.x11),!c),e.arc(i,n,s,ps(o.cy+o.y11,o.cx+o.x11),ps(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,ps(l.y11,l.x11),ps(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*gs(ps(l.y01,l.x01)),n+l.cy+r*ys(ps(l.y01,l.x01))):e.moveTo(i+P,n+s*ys(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>os)||g<.001)!a||a[1]?e.lineTo(i+E,n+R):e.moveTo(i+E,n+R),d=!0;else if(M>os){const t=ms(S,M),s=ms(x,M),o=TE(E,R,P,B,r,-s,Number(c)),l=TE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,ps(o.y01,o.x01),ps(o.y11,o.x11),!c),e.arc(i,n,r,ps(o.cy+o.y11,o.cx+o.x11),ps(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,ps(l.y11,l.x11),ps(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*gs(ps(l.y01,l.x01)),n+l.cy+t*ys(ps(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+R):e.moveTo(i+E,n+R),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*gs(_),n+r*ys(_))}return a?a[3]&&e.lineTo(i+s*gs(l),n+s*gs(l)):e.closePath(),d}class RE{static GetCanvas(){try{return RE.canvas||(RE.canvas=$k.global.createCanvas({})),RE.canvas}catch(t){return null}}static GetCtx(){if(!RE.ctx){const t=RE.GetCanvas();RE.ctx=t.getContext("2d")}return RE.ctx}}class PE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=RE.GetCanvas(),n=RE.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=PE.dataMap.get(i);return n||(n=new PE(t,e),PE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){PE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return PE.dataMap.get(t)}}PE.dataMap=new Map;class BE{static GetSize(t){for(let e=0;e=t)return BE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=BE.GenKey(t,e,i,n,s),l=BE.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=BE.GenKey(t,e,i,n,s);BE.cache[l]?BE.cache[l].push({width:a,height:o,pattern:r}):BE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}BE.cache={},BE.ImageSize=[20,40,80,160,320,640,1280,2560];const IE=Symbol.for("ArcRenderContribution"),DE=Symbol.for("AreaRenderContribution"),LE=Symbol.for("CircleRenderContribution"),OE=Symbol.for("GroupRenderContribution"),FE=Symbol.for("ImageRenderContribution"),zE=Symbol.for("PathRenderContribution"),HE=Symbol.for("PolygonRenderContribution"),jE=Symbol.for("RectRenderContribution"),NE=Symbol.for("SymbolRenderContribution"),VE=Symbol.for("TextRenderContribution"),WE=Symbol.for("InteractiveSubRenderContribution");var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},YE=function(t,e){return function(i,n){e(i,n,t)}};let $E=class{constructor(t){this.arcRenderContribitions=t,this.numberType=zT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=us(d-c),p=d>c;let g=!1;if(sos||M>os)&&(D=s*gs(v),L=s*ys(v),O=r*gs(x),F=r*ys(x),uos){const t=ms(S,T),r=ms(w,T),a=TE(O,F,R,P,s,t,Number(p)),o=TE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,ps(o.y11,o.x11),ps(o.y01,o.x01),!p)}}else e.moveTo(i+R,n+P);if(!(r>os)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>os){const t=ms(k,E),s=ms(A,E),a=TE(B,I,D,L,r,-s,Number(p)),o=TE(R,P,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,ps(a.y01,a.x01),ps(a.y11,a.x11),!p);const t=ps(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*gs(x),n+r*ys(x));return g}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,fillOpacity:p=l.fillOpacity,lineWidth:g=l.lineWidth,strokeOpacity:f=l.strokeOpacity,visible:m=l.visible,x:y=l.x,y:_=l.y}=t.attribute,v=SE(u,p),b=AE(u,f),x=bE(h),S=xE(d,g);if(!t.valid||!m)return;if(!(x||S||c))return;if(!(v||b||a||o||c))return;const{outerRadius:w=l.outerRadius,innerRadius:A=l.innerRadius,cap:k=l.cap,forceShowCap:M=l.forceShowCap}=t.attribute;let C=!1;const{isFullStroke:T,stroke:E}=(t=>{var e;let i=!0;if(Yi(t,!0)){for(let n=0;n<4;n++)xC[n]=t,i&&(i=!(null!==(e=xC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)xC[e]=!!t[e],i&&(i=!!xC[e]);else xC[0]=!1,xC[1]=!1,xC[2]=!1,xC[3]=!1;return{isFullStroke:i,stroke:xC}})(d);if(x||T||c){if(e.beginPath(),EE(t,e,i,n,w,A),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===LA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}C=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),x&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,y-i,_-n,l),e.fill())),S&&T&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,y-i,_-n,l),e.stroke()))}if(!T&&S){if(e.beginPath(),EE(t,e,i,n,w,A,E),!C){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===LA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}C=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)}))}o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())}if(k&&M){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(us(h-r)>=ds-os){e.beginPath();const r=Math.abs(w-A)/2/w,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,n,w,A,d,d+r),!C){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===LA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}C=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)}))}if(x){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=ds;for(;i>ds;)i-=ds;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),cT(o.color,l.color,h,!1)}(0,0,h,s);a||SE&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=r,e.fill())}}S&&(o||b&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,x,S,v,b,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=jM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};$E=UE([qw(),YE(0,Qw(sA)),YE(0,Zw(IE)),GE("design:paramtypes",[Object])],$E);var XE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qE=function(t,e){return function(i,n){e(i,n,t)}};let ZE=class{constructor(t){this.circleRenderContribitions=t,this.numberType=NT}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=SE(y,f),w=AE(y,m),A=bE(h),k=xE(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};ZE=XE([qw(),qE(0,Qw(sA)),qE(0,Zw(LE)),KE("design:paramtypes",[Object])],ZE);const JE=["radius","startAngle","endAngle",...TT];class QE extends IT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=NT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=jM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=$k.graphicService.updateCircleAABBBounds(i,jM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=wC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function eR(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function iR(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class nR{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=QT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=jM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=jM(this).text,n=$k.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=eR(c,s),e=iR(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=eR(c,s),_=iR(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=jM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const g=$k.graphicUtil.textMeasure,f=new nR(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).text[t]}needUpdateTags(t){for(let e=0;e{YR[t.type]=t}));const $R=["symbolType","size",...TT];let XR=class t extends IT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=JT}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return en(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=jM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=YR[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new mk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/fs(r,a);return s.transform(0,0,o,o),this._parsedPath=new GR(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=jM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=$k.graphicService.updateSymbolAABBBounds(i,jM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=wC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).symbol[t]}needUpdateTags(t){for(let e=0;e<$R.length;e++){const i=$R[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$R.length;e++)if(t===$R[e])return!0;return!1}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=en(e)?e:[e,e];return t.path?(new mk).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new mk).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}};XR.userSymbolMap={};const KR=["segments","points","curveType",...TT];let qR=class t extends IT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=TC(i,n,e))}doUpdateAABBBounds(){const t=jM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateLineAABBBounds(e,jM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const ZR=["width","height","cornerRadius",...TT];class JR extends IT{constructor(t){super(t),this.type="rect",this.numberType=KT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=jM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateRectAABBBounds(e,jM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).rect[t]}needUpdateTags(t){for(let e=0;e{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=$k.graphicService.updateGlyphAABBBounds(this.attribute,jM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new eP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const iP={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},nP=!0,sP=!1,rP=/\w|\(|\)/,aP=/[.?!,;:/,。?!、;:]/,oP=/\S/;function lP(t,e,i,n,s){if(!e||e<=0)return 0;const r=$k.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=function(t,e){let i=e;for(;rP.test(t[i-1])&&rP.test(t[i])||aP.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function hP(t,e){const i=$k.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class cP{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=iP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class dP{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=hP(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=hP(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=lP(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=hP(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||sP;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||nP;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=lP(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=hP(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const uP=["width","height","image",...TT];class pP extends IT{constructor(t){super(t),this.type="image",this.numberType=UT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=jM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateImageAABBBounds(e,jM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Hk[t]}needUpdateTags(t){for(let e=0;e{if(en(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=wC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Hk.width,height:e=Hk.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class fP{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof gP?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=iP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof dP){const e=oP.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof gP)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=hP("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof gP)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof gP)break;const{width:n}=hP("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof gP?t.width:t.getWidthWithEllips(this.direction)})),e}}class mP{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=iP[this.direction]}store(t){if(t instanceof gP){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new fP(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof gP?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=lP(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new dP(i,t.newLine,t.character),new dP(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const yP=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...TT];class _P extends IT{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ZT}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:zk.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:zk.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:zk.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:zk.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:zk.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:zk.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:zk.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:zk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=jM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateRichTextAABBBounds(e,jM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return zk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new mP(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const vP=["path","customPath",...TT];class bP extends IT{constructor(t){super(t),this.type="path",this.numberType=YT}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=jM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof mk?e.path:(Xi(this.cache)&&this.doUpdatePathShape(),this.cache instanceof mk?this.cache:t.path)}doUpdateAABBBounds(){const t=jM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updatePathAABBBounds(e,jM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;tn(t.path,!0)?this.cache=(new mk).fromString(t.path):t.customPath&&(this.cache=new mk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return jM(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new SP(Object.assign({},this.attribute))}}const wP=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...TT];class AP extends IT{constructor(t){super(t),this.type="arc",this.numberType=zT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=jM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(rn(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=jM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Bs(e),i=e+r,n&&us(r)os&&o>os)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=jM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=_s(n*n+s*s)}=this.attribute,o=us(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>os&&a>os){const i=e>t?1:-1;let r=xs(Number(a)/s*ys(u)),o=xs(Number(a)/n*ys(u));return(p-=2*r)>os?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>os?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=jM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=$k.graphicService.updateArcAABBBounds(i,jM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=wC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=ds-os)o.moveTo(0+s*gs(e),0+s*ys(e)),o.arc(0,0,s,e,i,!a),n>os&&(o.moveTo(0+n*gs(i),0+n*ys(i)),o.arc(0,0,n,i,e,a));else{const t=s*gs(e),r=s*ys(e),l=n*gs(i),h=n*ys(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new AP(Object.assign({},this.attribute))}}class kP extends AP{constructor(t){super(t),this.type="arc3d",this.numberType=HT}doUpdateAABBBounds(){const t=jM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updateArc3dAABBBounds(e,jM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const MP=["points","cornerRadius",...TT];class CP extends IT{constructor(t){super(t),this.type="polygon",this.numberType=$T}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=jM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updatePolygonAABBBounds(e,jM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=TC(i,n,e))}getDefaultAttribute(t){return jM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new CP(Object.assign({},this.attribute))}}class TP extends CP{constructor(t){super(t),this.type="pyramid3d",this.numberType=XT}doUpdateAABBBounds(){const t=jM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=$k.graphicService.updatePyramid3dAABBBounds(e,jM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=wC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var EP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RP=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};RP=EP([qw()],RP);var PP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const BP=Symbol.for("RectBoundsContribution");let IP=class extends RP{};IP=PP([qw()],IP);var DP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const LP=Symbol.for("SymbolBoundsContribution");let OP=class extends RP{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;LT(i,n+r+o/2,!0,a)}return i}};OP=DP([qw()],OP);var FP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const zP=Symbol.for("CircleBoundsContribution");let HP=class extends RP{};HP=FP([qw()],HP);var jP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const NP=Symbol.for("ArcBoundsContribution");let VP=class extends RP{};VP=jP([qw()],VP);var WP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const UP=Symbol.for("PathBoundsContribution");let GP=class extends RP{};GP=WP([qw()],GP);class YP{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return YP.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZP=function(t,e){return function(i,n){e(i,n,t)}};function JP(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function QP(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function tB(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function eB(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),JP(t,t,[s+o,r+l,a+h]),JP(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),JP(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=XP.allocate(),n=[0,0];if(y){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}JP(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),JP(i,i,[-n[0],-n[1],0]),tB(t,t,i)}}let iB=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new lA(["graphic"]),onSetStage:new lA(["graphic","stage"]),onRemove:new lA(["graphic"]),onAddIncremental:new lA(["graphic","group","stage"]),onClearIncremental:new lA(["graphic","group","stage"]),beforeUpdateAABBBounds:new lA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new lA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Ts,this.tempAABBBounds2=new Ts}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new mA(t);return jA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),Ms(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>ds-os?i.set(-a,-a,a,a):MC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=os?i.set(0,0,0,0):Math.abs(a-o)>ds-os?i.set(-s,-s,s,s):(MC(o,a,s,i),MC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(en(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){LT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){LT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Ms(e,e,s.transMatrix)}};iB=KP([qw(),ZP(0,Qw(eE)),ZP(1,Qw(sA)),ZP(1,Zw(BP)),ZP(2,Qw(sA)),ZP(2,Zw(LP)),ZP(3,Qw(sA)),ZP(3,Zw(zP)),ZP(4,Qw(sA)),ZP(4,Zw(NP)),ZP(5,Qw(sA)),ZP(5,Zw(UP)),qP("design:paramtypes",[Object,Object,Object,Object,Object,Object])],iB);class nB extends nE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const sB=["heightLimit","lineClamp"];class rB extends rR{_isValid(){const{text:t}=this.attribute;return en(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=jM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=$k.graphicUtil.textMeasure,f=new nR(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=XP.allocate(),s=XP.allocate();eB(s,t,e),tB(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),XP.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,y,_,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function AB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),kB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=IA.ROW:"y"===n?c=IA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CB=class extends wB{constructor(){super(...arguments),this.numberType=GT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const m=null!==(f=this.z)&&void 0!==f?f:0;AB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:m}),u.cache&&!en(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,y-c,_-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,y-c,_-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=SE(d,u),y=AE(d,p),_=bE(h),v=xE(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined),s=fk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=fk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],ms(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function TB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),EB(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),EB(t,l,1,n),o=!1):o=!0}t.closePath()}function EB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=GA(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}CB=MB([qw()],CB);var RB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BB=function(t,e){return function(i,n){e(i,n,t)}};function IB(t,e,i){switch(e){case"linear":default:return QA(t,i);case"basis":return ik(t,i);case"monotoneX":return hk(t,i);case"monotoneY":return ck(t,i);case"step":return uk(t,.5,i);case"stepBefore":return uk(t,0,i);case"stepAfter":return uk(t,1,i);case"linearClosed":return gk(t,i)}}let DB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=jM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=SE(y,m),A=bE(f),k=xE(b,x),M=AE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=IB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=IB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const r=IB(i,n),a=IB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],ms(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=jM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?IA.ROW:IA.COLUMN,Number.isFinite(c)||(o=IA.COLUMN),Number.isFinite(d)||(o=IA.ROW);const u=i*(o===IA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===LA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:m=0,x:y=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,m-h,y-c,o),t.fill())),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;en(i)&&i[0]&&!1===i[1]&&(t.beginPath(),AB(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,m-h,y-c,o),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===LA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1}};DB=RB([qw(),BB(0,Qw(sA)),BB(0,Zw(DE)),PB("design:paramtypes",[Object])],DB);var LB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FB=function(t,e){return function(i,n){e(i,n,t)}};let zB=class extends wB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=jM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=SE(f,p),w=AE(f,g),A=bE(d),k=xE(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)jA(t.pathShape.commandList,e,i,n,1,1,x);else{jA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};zB=LB([qw(),FB(0,Qw(sA)),FB(0,Zw(zE)),OB("design:paramtypes",[Object])],zB);const HB=ls/2;function jB(t,e,i,n,s,r){let a;if(rn(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],v=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!Rn(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-HB,0,!1)}if(t.lineTo(_[0],_[1]),!Rn(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,HB,!1)}if(t.lineTo(v[0],v[1]),!Rn(v,b)){const e=v[0],i=v[1]-u[3];t.arc(e,i,u[3],HB,ls,!1)}if(t.lineTo(g[0],g[1]),!Rn(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],ls,ls+HB,!1)}return t.closePath(),t}var NB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:_=l.strokeOpacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=wE(f,m,u,p),w=kE(f,_,u,p),A=bE(h),k=xE(d,y);if(!t.valid||!v)return;if(!(A||k||c))return;if(!(S||w||a||o||c))return;0===g||en(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),jB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const M={doFill:A,doStroke:k};this._rectRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o,M)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),M.doFill&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),M.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};UB=NB([qw(),WB(0,Qw(sA)),WB(0,Zw(jE)),VB("design:paramtypes",[Object])],UB);var GB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$B=function(t,e){return function(i,n){e(i,n,t)}};let XB=class extends wB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=JT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=SE(f,p),A=AE(f,g),k=bE(d),M=xE(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};XB=GB([qw(),$B(0,Qw(sA)),$B(0,Zw(NE)),YB("design:paramtypes",[Object])],XB);var KB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZB=function(t,e){return function(i,n){e(i,n,t)}};let JB=class extends wB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=QT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=SE(f,p),C=AE(f,g),T=bE(d),E=xE(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const R=!b,P=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===LA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),R&&this.transformUseContext2d(t,h,P,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,P);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,P)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,P),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,P,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,P);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,P))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,P),this.drawUnderLine(_,v,t,i,n+r,P,h,e)))}R&&this.restoreTransformUseContext2d(t,h,P,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=eR(l,g),m=iR(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=eR(h,a),f=iR("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};JB=KB([qw(),ZB(0,Qw(sA)),ZB(0,Zw(VE)),qB("design:paramtypes",[Object])],JB);var QB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tI=class{};function eI(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aI=function(t,e){return function(i,n){e(i,n,t)}};let oI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=$T}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:_=l.visible,x:v=l.x,y:b=l.y}=t.attribute,x=SE(y,p),S=AE(y,f),w=bE(c),A=xE(d,m);t.valid&&_&&(w||A||g)&&(x||S||a||o||g)&&(e.beginPath(),u<=0||en(u)&&u.every((t=>0===t))?eI(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)eI(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=nI(l,y,_,c,d),S=nI(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=iI(w,A),M=nI(l,iI(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,w,A,x,S,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),w&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,v-i,b-n,l),e.fill())),A&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,w,A,x,S,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=jM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);ME(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};oI=sI([qw(),aI(0,Qw(sA)),aI(0,Zw(HE)),rI("design:paramtypes",[Object])],oI);var lI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cI=function(t,e){return function(i,n){e(i,n,t)}};const dI=["","repeat-x","repeat-y","repeat"];let uI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=UT}drawShape(t,e,i,n,s,r,a){const o=jM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=SE(d,u),_=bE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,dI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=jM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};uI=lI([qw(),cI(0,Qw(sA)),cI(0,Zw(FE)),hI("design:paramtypes",[Object])],uI);const pI=Symbol.for("IncrementalDrawContribution"),gI=Symbol.for("ArcRender"),fI=Symbol.for("Arc3dRender"),mI=Symbol.for("AreaRender"),yI=Symbol.for("CircleRender"),_I=Symbol.for("GraphicRender"),vI=Symbol.for("GroupRender"),bI=Symbol.for("LineRender"),xI=Symbol.for("PathRender"),SI=Symbol.for("PolygonRender"),wI=Symbol.for("RectRender"),AI=Symbol.for("Rect3DRender"),kI=Symbol.for("SymbolRender"),MI=Symbol.for("TextRender"),CI=Symbol.for("RichTextRender"),TI=Symbol.for("Pyramid3dRender"),EI=Symbol.for("GlyphRender"),RI=Symbol.for("ImageRender"),PI=Symbol.for("RenderSelector"),BI=Symbol.for("DrawContribution");function II(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function DI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(en(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const LI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return qk(Object.assign({nativeCanvas:$k.global.createCanvas(t)},t));const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr};return qk(Object.assign({nativeCanvas:$k.global.createCanvas(e)},e))}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};var OI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zI=function(t,e){return function(i,n){e(i,n,t)}};let HI=class{constructor(){this.time=LA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=jM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};HI=OI([qw()],HI);let jI=class{constructor(t){this.subRenderContribitions=t,this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};jI=OI([qw(),zI(0,Qw(sA)),zI(0,Zw(WE)),FI("design:paramtypes",[Object])],jI);let NI=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=LI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return LI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,ds),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};NI=OI([qw()],NI);var VI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WI=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=II(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),EE(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=II(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),EE(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};WI=VI([qw()],WI);let UI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};UI=VI([qw()],UI);let GI=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};GI=VI([qw()],GI);var YI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $I=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=II(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=II(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};$I=YI([qw()],$I);let XI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};XI=YI([qw()],XI);let KI=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};KI=YI([qw()],KI);var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};ZI=qI([qw()],ZI);var JI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let QI=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=jM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};QI=JI([qw()],QI);var tD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eD=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=II(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||en(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),jB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=II(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||en(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),jB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};eD=tD([qw()],eD);let iD=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};iD=tD([qw()],iD);let nD=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};nD=tD([qw()],nD);let sD=class{constructor(){this.time=LA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};sD=tD([qw()],sD);let rD=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};rD=tD([qw()],rD);var aD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let oD=class{constructor(){this.time=LA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=II(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=II(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};oD=aD([qw()],oD);class lD extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}}class hD extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}}var cD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uD=function(t,e){return function(i,n){e(i,n,t)}};const pD=Symbol.for("RenderService");let gD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};gD=cD([qw(),uD(0,Qw(BI)),dD("design:paramtypes",[Object])],gD);var fD=new Gw((t=>{t(gD).toSelf(),t(pD).toService(gD)})),mD=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function yD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return mD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function vD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var bD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const xD=Symbol.for("PickItemInterceptor");let SD=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===HT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=ds;for(;o<0;)o+=ds;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};SD=bD([qw()],SD);var wD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kD=function(t,e){return function(i,n){e(i,n,t)}};const MD=Symbol.for("PickerService");let CD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ls(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=XP.allocate();if(QP(i,e),a){if(i){const t=XP.allocate();r.modelMatrix=tB(t,a,i),XP.free(i)}}else QP(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new As(e.x,e.y),a=jM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new As(e.x,e.y);l.transformPoint(r,r);const a=jM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&XP.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),$P.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};CD=wD([qw(),kD(0,Qw(cA)),kD(1,Qw(sA)),kD(1,Zw(xD)),AD("design:paramtypes",[Object,Object])],CD);var TD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ED=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RD=function(t,e){return function(i,n){e(i,n,t)}};const PD=Symbol.for("GlobalPickerService");let BD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new Ls(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new As(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function ID(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function DD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}BD=TD([qw(),RD(0,Qw(cA)),ED("design:paramtypes",[Object])],BD);class LD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=XP.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=XP.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zD=[0,0,0],HD=new Ls(1,0,0,1,0,0);let jD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},bk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Sk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},wk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ls(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ls(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ls(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return $P.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=ds;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&BE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(DD(zD,[t,e,i],this.modelMatrix),t=zD[0],e=zD[1],i=zD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(DD(zD,[t,e,i],this.modelMatrix),t=zD[0],e=zD[1],i=zD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(DD(zD,[e,i,n],this.modelMatrix),e=zD[0],i=zD[1],n=zD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$k.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=$k.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:wk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:wk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(DD(zD,[e,i,n],this.modelMatrix),e=zD[0],i=zD[1],n=zD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=DI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=II(this,l,this.dpr),r.strokeStyle=DI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=tR(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=tR(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(HD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>$P.free(t))),this.stack.length=0}};jD.env="browser",jD=OD([qw(),FD("design:paramtypes",[Object,Number])],jD);var ND=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const WD={WIDTH:500,HEIGHT:500,DPR:1};let UD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=WD.WIDTH,height:n=WD.HEIGHT,dpr:s=WD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=$k.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new jD(this,this._dpr),this._id=e.id,this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};UD.env="browser",UD=ND([qw(),VD("design:paramtypes",[Object])],UD);const GD=Symbol.for("CanvasArcPicker"),YD=Symbol.for("CanvasArc3dPicker"),$D=Symbol.for("CanvasAreaPicker"),XD=Symbol.for("CanvasCirclePicker"),KD=Symbol.for("CanvasImagePicker"),qD=Symbol.for("CanvasLinePicker"),ZD=Symbol.for("CanvasPathPicker"),JD=Symbol.for("CanvasRectPicker"),QD=Symbol.for("CanvasRect3dPicker"),tL=Symbol.for("CanvasSymbolPicker"),eL=Symbol.for("CanvasTextPicker"),iL=Symbol.for("CanvasPolygonPicker"),nL=Symbol.for("CanvasPyramid3dPicker"),sL=Symbol.for("CanvasRichTextPicker"),rL=Symbol.for("CanvasGlyphPicker"),aL=Symbol.for("CanvasPickerContribution"),oL=Symbol.for("MathArcPicker"),lL=Symbol.for("MathAreaPicker"),hL=Symbol.for("MathCirclePicker"),cL=Symbol.for("MathLinePicker"),dL=Symbol.for("MathPathPicker"),uL=Symbol.for("MathRectPicker"),pL=Symbol.for("MathSymbolPicker"),gL=Symbol.for("MathTextPicker"),fL=Symbol.for("MathPolygonPicker"),mL=Symbol.for("MathGlyphPicker"),yL=Symbol.for("MathPickerContribution");var _L=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bL=function(t,e){return function(i,n){e(i,n,t)}};let xL=class extends CD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new UD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const AL=new Ls(1,0,0,1,0,0),kL={x:0,y:0};let ML=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ls(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ls(1,0,0,1,0,0),this.path=new mk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return $P.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&($P.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},kL),function(t,e,i){return kM(t,0,!1,e,i)}(this.path.commandList,kL.x,kL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},kL);const i=II(this,this.lineWidth,this.dpr);return function(t,e,i,n){return kM(t,e,!0,i,n)}(this.path.commandList,i,kL.x,kL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(AL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>$P.free(t))),this.stack.length=0}};ML=SL([qw(),wL("design:paramtypes",[Object,Number])],ML);var CL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EL=function(t,e){return function(i,n){e(i,n,t)}};let RL=class extends CD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new ML(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};CL([nA(),TL("design:type",Function),TL("design:paramtypes",[]),TL("design:returntype",void 0)],RL.prototype,"init",null),RL=CL([qw(),EL(0,Qw(sA)),EL(0,Zw(yL)),EL(1,Qw(cA)),EL(2,Qw(sA)),EL(2,Zw(xD)),TL("design:paramtypes",[Object,Object,Object])],RL);var PL=new Gw((t=>{t(xL).toSelf().inSingletonScope(),t(RL).toSelf().inSingletonScope(),t(MD).toService(xL),t(BD).toSelf().inSingletonScope(),t(PD).toService(BD),t(SD).toSelf().inSingletonScope(),t(xD).toService(SD),aA(t,xD)})),BL=new Gw((t=>{t(iB).toSelf().inSingletonScope(),t(tE).toService(iB),t(IP).toSelf().inSingletonScope(),t(BP).toService(IP),aA(t,BP),t(OP).toSelf().inSingletonScope(),t(LP).toService(OP),aA(t,LP),t(HP).toSelf().inSingletonScope(),t(zP).toService(HP),aA(t,zP),t(VP).toSelf().inSingletonScope(),t(NP).toService(VP),aA(t,NP),t(GP).toSelf().inSingletonScope(),t(UP).toService(GP),aA(t,UP),t(eE).toConstantValue(vB)}));const IL=Symbol.for("AutoEnablePlugins"),DL=Symbol.for("PluginService");var LL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FL=function(t,e){return function(i,n){e(i,n,t)}};let zL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Yk.isBound(IL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};zL=LL([qw(),FL(0,Qw(sA)),FL(0,Zw(IL)),OL("design:paramtypes",[Object])],zL);var HL=new Gw((t=>{t(zL).toSelf(),t(DL).toService(zL),aA(t,IL)})),jL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}};NL=jL([qw()],NL);var VL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function UL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let GL=class extends NL{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(an(o)?o:1),y:(s-r.top)/(an(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return UL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return UL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:NM.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}};function YL(){Yk.rebind(MD).toService(RL)}GL=VL([qw(),WL("design:paramtypes",[])],GL);var $L=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KL=class extends NL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),YL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};KL=$L([qw(),XL("design:paramtypes",[])],KL);var qL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JL=class extends NL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Yk.rebind(MD).toService(RL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};JL=qL([qw(),ZL("design:paramtypes",[])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let eO=!1;try{eO=!!lynx.createCanvasNG}catch(t){}let iO=class extends NL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=eO?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,eO&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),YL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};iO=QL([qw(),tO("design:paramtypes",[])],iO);var nO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sO=class extends NL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};sO=nO([qw()],sO);var rO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let lO=class extends NL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return oO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{YL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};lO=rO([qw(),aO("design:paramtypes",[])],lO);var hO=new Gw((t=>{t(GL).toSelf().inSingletonScope(),t(hA).toService(GL),t(KL).toSelf().inSingletonScope(),t(hA).toService(KL),t(JL).toSelf().inSingletonScope(),t(hA).toService(JL),t(iO).toSelf().inSingletonScope(),t(hA).toService(iO),t(lO).toSelf().inSingletonScope(),t(hA).toService(lO),t(sO).toSelf().inSingletonScope(),t(hA).toService(sO),aA(t,hA)})),cO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uO=class{constructor(){this._uid=NM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};uO=cO([qw(),dO("design:paramtypes",[])],uO);var pO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fO=function(t,e){return function(i,n){e(i,n,t)}};let mO=class extends uO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:NM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new UD(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new UD({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};mO.env="browser",mO=pO([qw(),fO(0,Qw(cA)),gO("design:paramtypes",[Object])],mO);var yO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _O=class extends jD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};_O.env="feishu",_O=yO([qw()],_O);var vO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xO={WIDTH:500,HEIGHT:500,DPR:1};let SO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=xO.WIDTH,height:n=xO.HEIGHT,dpr:s=xO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new _O(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};SO.env="feishu",SO=vO([qw(),bO("design:paramtypes",[Object])],SO);var wO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kO=function(t,e){return function(i,n){e(i,n,t)}};let MO=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new SO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new SO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};MO.env="feishu",MO=wO([qw(),kO(0,Qw(cA)),AO("design:paramtypes",[Object])],MO);var CO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TO=class extends jD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(DI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(II(this,l,this.dpr)),r.setStrokeStyle(DI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=tR(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=tR(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};TO.env="taro",TO=CO([qw()],TO);var EO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const PO={WIDTH:500,HEIGHT:500,DPR:1};let BO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=PO.WIDTH,height:n=PO.HEIGHT,dpr:s=PO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new TO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};BO.env="taro",BO=EO([qw(),RO("design:paramtypes",[Object])],BO);var IO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LO=function(t,e){return function(i,n){e(i,n,t)}};let OO=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new BO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new BO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};OO.env="taro",OO=IO([qw(),LO(0,Qw(cA)),DO("design:paramtypes",[Object])],OO);var FO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zO=class extends jD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=II(this,l,this.dpr),r.strokeStyle=DI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};zO.env="lynx",zO=FO([qw()],zO);var HO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const NO={WIDTH:500,HEIGHT:500,DPR:1};let VO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=NO.WIDTH,height:n=NO.HEIGHT,dpr:s=NO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new zO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};VO.env="lynx",VO=HO([qw(),jO("design:paramtypes",[Object])],VO);var WO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GO=function(t,e){return function(i,n){e(i,n,t)}};let YO=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new VO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new VO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};YO.env="lynx",YO=WO([qw(),GO(0,Qw(cA)),UO("design:paramtypes",[Object])],YO);var $O=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KO=class extends jD{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ls(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};KO.env="node",KO=$O([qw(),XO("design:paramtypes",[Object,Number])],KO);var qO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const JO={WIDTH:500,HEIGHT:500,DPR:1};let QO=class{get id(){return this._id}get x(){return 0}get y(){return 0}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=JO.WIDTH,height:n=JO.HEIGHT,canvasControled:s=!0,dpr:r=JO.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new KO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&$i(this._nativeCanvas.release)&&this._nativeCanvas.release()}};QO.env="node",QO=qO([qw(),ZO("design:paramtypes",[Object])],QO);var tF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iF=function(t,e){return function(i,n){e(i,n,t)}};let nF=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new QO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new QO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};nF.env="node",nF=tF([qw(),iF(0,Qw(cA)),eF("design:paramtypes",[Object])],nF);var sF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rF=class extends jD{draw(){}createPattern(t,e){return null}};rF.env="wx",rF=sF([qw()],rF);var aF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const lF={WIDTH:500,HEIGHT:500,DPR:1};let hF=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=lF.WIDTH,height:n=lF.HEIGHT,dpr:s=lF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new rF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};hF.env="wx",hF=aF([qw(),oF("design:paramtypes",[Object])],hF);var cF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uF=function(t,e){return function(i,n){e(i,n,t)}};class pF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let gF=class extends uO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new pF}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:NM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new hF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new hF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};gF.env="wx",gF=cF([qw(),uF(0,Qw(cA)),dF("design:paramtypes",[Object])],gF);var fF=new Gw((t=>{t(mO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(mO))).whenTargetNamed(mO.env),t(MO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(MO))).whenTargetNamed(MO.env),t(OO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(OO))).whenTargetNamed(OO.env),t(YO).toSelf(),t(gE).toDynamicValue((t=>t.container.get(YO))).whenTargetNamed(YO.env),t(gF).toSelf(),t(gE).toDynamicValue((t=>t.container.get(gF))).whenTargetNamed(gF.env),t(nF).toSelf(),t(gE).toDynamicValue((t=>t.container.get(nF))).whenTargetNamed(nF.env)})),mF=new Gw((t=>{t(Gk).toSelf().inSingletonScope(),t(Uk).toService(Gk),aA(t,Uk)})),yF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vF=function(t,e){return function(i,n){e(i,n,t)}};let bF=class{constructor(t){this.global=t,this.offscreen=!1}init(t,e,i){if(this.layer=t,i.main)this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=qk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};bF=yF([qw(),vF(0,Qw(cA)),_F("design:paramtypes",[Object])],bF);var xF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wF=function(t,e){return function(i,n){e(i,n,t)}};let AF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=qk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};AF=xF([qw(),wF(0,Qw(cA)),SF("design:paramtypes",[Object])],AF);var kF=new Gw((t=>{t(bF).toSelf(),t(AF).toSelf(),t(sE).toService(bF)}));var MF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const CF=Symbol.for("DrawItemInterceptor"),TF=new Ts;let EF=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){TF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(TF),!0}};EF=MF([qw()],EF);let RF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=XP.allocate();QP(l,o);const h=r.modelMatrix;if(h){if(l){const t=XP.allocate();r.modelMatrix=tB(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===HT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=ds;for(;o<0;)o+=ds;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&XP.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};RF=MF([qw()],RF);var PF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IF=function(t,e){return function(i,n){e(i,n,t)}};let DF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Cs,this.backupDirtyBounds=new Cs}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=(h=l,c=n.dirtyBounds,d=!1,null===h?c:null===c?h:(Ks=h.x1,qs=h.x2,Zs=h.y1,Js=h.y2,Qs=c.x1,tr=c.x2,er=c.y1,ir=c.y2,d&&(Ks>qs&&([Ks,qs]=[qs,Ks]),Zs>Js&&([Zs,Js]=[Js,Zs]),Qs>tr&&([Qs,tr]=[tr,Qs]),er>ir&&([er,ir]=[ir,er])),Ks>=tr||qs<=Qs||Zs>=ir||Js<=er?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Ks,Qs),y1:Math.max(Zs,er),x2:Math.min(qs,tr),y2:Math.min(Js,ir)}));l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}var h,c,d;this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const u=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),u&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:kk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=vD(e,i,kk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(!ar(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):yD(t,kk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Yk.get(pI);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let OF=class{selector(t){return null}};OF=LF([qw()],OF);var FF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HF=function(t,e){return function(i,n){e(i,n,t)}};let jF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){const l=jM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:v=l.path,lineWidth:b=l.lineWidth,visible:x=l.visible}=t.attribute,S=wE(u,m,p,g),w=kE(u,y,p,g),A=bE(h),k=xE(d,b);if(!t.valid||!x)return;if(!f){if(!(A||k||c))return;if(!(S||w||a||o||c))return}if(v&&v.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,v.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===_||en(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),jB(e,i,n,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const M={doFill:A,doStroke:k};this._groupRenderContribitions.forEach((r=>{r.time===LA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o,M)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),M.doFill&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),M.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===LA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=jM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=XP.allocate(),i=XP.allocate();eB(i,t,a),tB(e,o||e,i),s.modelMatrix=e,XP.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&XP.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};jF=FF([qw(),HF(0,Qw(sA)),HF(0,Zw(OE)),zF("design:paramtypes",[Object])],jF);var NF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let VF=class extends CB{constructor(){super(...arguments),this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=jM(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,y=SE(u,p),_=AE(u,g),v=bE(c),b=xE(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};VF=NF([qw()],VF);var WF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let UF=class extends DB{constructor(){super(...arguments),this.numberType=jT}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=jM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=SE(u,d),f=bE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};UF=WF([qw()],UF);var GF,YF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XF=function(t,e){return function(i,n){e(i,n,t)}},KF=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(GF||(GF={}));let qF=class extends DF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=GF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new lA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return KF(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:kk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:kk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return KF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return KF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>KF(this,void 0,void 0,(function*(){if(2!==t.count)yield _D(t,kk.zIndex,((i,n)=>{if(this.status===GF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return KF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return KF(this,void 0,void 0,(function*(){this.rendering&&(this.status=GF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=GF.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return KF(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>KF(this,void 0,void 0,(function*(){yield _D(t,kk.zIndex,(t=>KF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};YF([Qw(cA),$F("design:type",Object)],qF.prototype,"global",void 0),qF=YF([qw(),XF(0,tA(_I)),XF(1,Qw(PI)),XF(2,Qw(VF)),XF(3,Qw(UF)),XF(4,Qw(_E)),XF(5,Qw(sA)),XF(5,Zw(CF)),$F("design:paramtypes",[Array,Object,Object,Object,Object,Object])],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JF=class extends wB{constructor(){super(...arguments),this.type="rect3d",this.numberType=qT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=wE(g,f,u,p),x=kE(g,y,u,p),S=bE(c),w=xE(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=aT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=jM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};JF=ZF([qw()],JF);var QF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tz=class{constructor(){this.numberType=ZT}drawShape(t,e,i,n,s){const r=jM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&SE(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=jM(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),jB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=jM(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};tz=QF([qw()],tz);var ez=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iz=class{constructor(){this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=jM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};iz=ez([qw()],iz);var nz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sz=class extends wB{constructor(){super(...arguments),this.numberType=HT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=SE(p,g),v=AE(p,m),b=bE(c),x=xE(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=aT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},R={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=us(l-o),c=l>o;let d=!1;if(r=ds-os)e.moveTo(i+r*gs(o),n+r*ys(o),s),e.arc(i,n,r,o,l,!c,s),a>os&&(e.moveTo(i+a*gs(l),n+a*ys(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*gs(p),_=r*ys(p),v=a*gs(f),b=a*ys(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>os)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(R[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,ds,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=us(h-l),d=h>l;let u=!1;if(a<=os)e.moveTo(i,n,s);else if(c>=ds-os)e.moveTo(i+a*gs(l),n+a*ys(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*gs(h),n+a*ys(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*gs(c),f=a*ys(c),m=a*gs(p),y=a*ys(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(R[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=jM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,ME(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&XP.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};sz=nz([qw()],sz);var rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let az=class extends wB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=XT}drawShape(t,e,i,n,s,r,a,o){var l;const h=jM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=SE(u,p),x=AE(u,f),S=bE(c),w=xE(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=aT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=jM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};az=rz([qw()],az);var oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lz=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};lz=oz([qw()],lz);let hz=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};hz=oz([qw()],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};dz=cz([qw()],dz);let uz=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}};uz=cz([qw()],uz);var pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gz=class extends HI{constructor(){super(...arguments),this.time=LA.beforeFillStroke}};gz=pz([qw()],gz);let fz=class extends NI{constructor(){super(...arguments),this.time=LA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:RC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:RC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:RC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:RC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};fz=pz([qw()],fz);var mz=new Gw((t=>{t(DF).toSelf(),t(BI).toService(DF),t(qF).toSelf(),t(pI).toService(qF),t(OF).toSelf(),t(PI).toService(OF),t(ZE).toSelf().inSingletonScope(),t(yI).to(ZE),t(_I).to(ZE),t($I).toSelf().inSingletonScope(),t(XI).toSelf().inSingletonScope(),t(KI).toSelf().inSingletonScope(),t(LE).toService($I),t(LE).toService(XI),t(LE).toService(KI),aA(t,LE),t(UB).toSelf().inSingletonScope(),t(wI).to(UB),t(_I).to(UB),t(JF).toSelf().inSingletonScope(),t(AI).toService(JF),t(_I).toService(AI),t(eD).toSelf().inSingletonScope(),t(iD).toSelf().inSingletonScope(),t(nD).toSelf().inSingletonScope(),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(jE).toService(eD),t(jE).toService(iD),t(jE).toService(nD),t(jE).toService(sD),t(jE).toService(rD),aA(t,jE),t(JB).toSelf().inSingletonScope(),t(MI).to(JB),t(_I).to(JB),aA(t,VE),t(zB).toSelf().inSingletonScope(),t(xI).to(zB),t(_I).to(zB),t(dz).toSelf().inSingletonScope(),t(uz).toSelf().inSingletonScope(),t(zE).toService(dz),t(zE).toService(uz),aA(t,zE),t(XB).toSelf().inSingletonScope(),t(kI).to(XB),t(_I).to(XB),t(oD).toSelf().inSingletonScope(),t(lD).toSelf().inSingletonScope(),t(hD).toSelf().inSingletonScope(),t(NE).toService(oD),t(NE).toService(lD),t(NE).toService(hD),aA(t,NE),t($E).toSelf().inSingletonScope(),t(gI).to($E),t(_I).to($E),t(sz).toSelf().inSingletonScope(),t(fI).toService(sz),t(_I).toService(fI),t(WI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(GI).toSelf().inSingletonScope(),t(IE).toService(WI),t(IE).toService(UI),t(IE).toService(GI),aA(t,IE),t(CB).toSelf().inSingletonScope(),t(bI).to(CB),t(_I).to(CB),t(VF).toSelf().inSingletonScope(),t(UF).toSelf().inSingletonScope(),t(DB).toSelf().inSingletonScope(),t(mI).to(DB),t(_I).to(DB),t(gz).toSelf().inSingletonScope(),t(fz).toSelf().inSingletonScope(),t(DE).toService(gz),t(DE).toService(fz),aA(t,DE),t(jF).toSelf().inSingletonScope(),t(vI).to(jF),t(_I).to(jF),t(ZI).toSelf().inSingletonScope(),t(OE).toService(ZI),aA(t,OE),t(oI).toSelf().inSingletonScope(),t(SI).to(oI),t(_I).to(oI),t(lz).toSelf().inSingletonScope(),t(hz).toSelf().inSingletonScope(),t(HE).toService(lz),t(HE).toService(hz),aA(t,HE),t(iz).toSelf().inSingletonScope(),t(EI).toService(iz),t(_I).toService(EI),t(uI).toSelf().inSingletonScope(),t(RI).toService(uI),t(_I).toService(RI),t(QI).toSelf().inSingletonScope(),t(FE).toService(QI),aA(t,FE),t(tz).toSelf().inSingletonScope(),t(CI).toService(tz),t(_I).toService(CI),t(az).toSelf().inSingletonScope(),t(TI).toService(az),t(_I).toService(TI),t(jI).toSelf().inSingletonScope(),t(VE).toService(jI),t(IE).toService(jI),t(zE).toService(jI),t(NE).toService(jI),t(jE).toService(jI),t(FE).toService(jI),t(LE).toService(jI),t(DE).toService(jI),t(HE).toService(jI),aA(t,WE),aA(t,_I),t(EF).toSelf().inSingletonScope(),t(CF).toService(EF),t(RF).toSelf().inSingletonScope(),t(CF).toService(RF),aA(t,CF)}));var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};let bz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=II(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};bz=yz([qw(),vz(0,Qw(yI)),_z("design:paramtypes",[Object])],bz);var xz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wz=function(t,e){return function(i,n){e(i,n,t)}};const Az=new Ts;let kz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=KT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||rn(r,!0)&&0!==r||en(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=II(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;Az.setValue(i.x1,i.y1,i.x2,i.y2),Az.expand(-r/2),h=!Az.containsPoint(e)}}return n.highPerformanceRestore(),h}};kz=xz([qw(),wz(0,Qw(wI)),Sz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=II(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Ez=Mz([qw(),Tz(0,Qw(gI)),Cz("design:paramtypes",[Object])],Ez);var Rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bz=function(t,e){return function(i,n){e(i,n,t)}};let Iz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=jT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Iz=Rz([qw(),Bz(0,Qw(mI)),Pz("design:paramtypes",[Object])],Iz);var Dz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lz=class{constructor(){this.type="image",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Lz=Dz([qw()],Lz);var Oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fz=class extends wB{};Fz=Oz([qw()],Fz);var zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=jM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=II(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Nz=zz([qw(),jz(0,Qw(bI)),Hz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Gz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=YT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=II(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Gz=Vz([qw(),Uz(0,Qw(xI)),Wz("design:paramtypes",[Object])],Gz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xz=function(t,e){return function(i,n){e(i,n,t)}};let Kz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=JT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=jM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=II(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Kz=Yz([qw(),Xz(0,Qw(kI)),$z("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};let Qz=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=QT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=jM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=iR(a,u,s),y=eR(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&XP.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Qz=qz([qw(),Jz(0,Qw(MI)),Zz("design:paramtypes",[Object])],Qz);var tH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iH=function(t,e){return function(i,n){e(i,n,t)}};let nH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=$T}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};nH=tH([qw(),iH(0,Qw(SI)),eH("design:paramtypes",[Object])],nH);var sH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aH=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let oH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ZT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};oH=sH([qw(),aH(0,Qw(CI)),rH("design:paramtypes",[Object])],oH);var lH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cH=function(t,e){return function(i,n){e(i,n,t)}};let dH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};dH=lH([qw(),cH(0,Qw(EI)),hH("design:paramtypes",[Object])],dH);var uH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gH=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let fH=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=qT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};fH=uH([qw(),gH(0,Qw(AI)),pH("design:paramtypes",[Object])],fH);var mH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_H=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let vH=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=XT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};vH=mH([qw(),_H(0,Qw(TI)),yH("design:paramtypes",[Object])],vH);var bH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SH=function(t,e){return function(i,n){e(i,n,t)}};new Ts;let wH=class extends Fz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=HT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&XP.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};wH=bH([qw(),SH(0,Qw(fI)),xH("design:paramtypes",[Object])],wH);var AH=new Gw(((t,e,i,n)=>{t(bz).toSelf().inSingletonScope(),t(XD).toService(bz),t(aL).toService(XD),t(kz).toSelf().inSingletonScope(),t(JD).toService(kz),t(aL).toService(JD),t(fH).toSelf().inSingletonScope(),t(QD).toService(fH),t(aL).toService(QD),t(Ez).toSelf().inSingletonScope(),t(GD).toService(Ez),t(aL).toService(GD),t(Iz).toSelf().inSingletonScope(),t($D).toService(Iz),t(aL).toService($D),t(Lz).toSelf().inSingletonScope(),t(KD).toService(Lz),t(aL).toService(KD),t(Nz).toSelf().inSingletonScope(),t(qD).toService(Nz),t(aL).toService(qD),t(Gz).toSelf().inSingletonScope(),t(ZD).toService(Gz),t(aL).toService(ZD),t(Kz).toSelf().inSingletonScope(),t(tL).toService(Kz),t(aL).toService(tL),t(Qz).toSelf().inSingletonScope(),t(eL).toService(Qz),t(aL).toService(eL),t(nH).toSelf().inSingletonScope(),t(iL).toService(nH),t(aL).toService(iL),t(vH).toSelf().inSingletonScope(),t(nL).toService(vH),t(aL).toService(nL),t(wH).toSelf().inSingletonScope(),t(YD).toService(wH),t(aL).toService(YD),t(oH).toSelf().inSingletonScope(),t(sL).toService(oH),t(aL).toService(sL),t(dH).toSelf().inSingletonScope(),t(rL).toService(dH),t(aL).toService(rL),aA(t,aL)})),kH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CH=function(t,e){return function(i,n){e(i,n,t)}};let TH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=YT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};TH=kH([qw(),CH(0,Qw(xI)),MH("design:paramtypes",[Object])],TH);var EH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PH=function(t,e){return function(i,n){e(i,n,t)}};let BH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};BH=EH([qw(),PH(0,Qw(yI)),RH("design:paramtypes",[Object])],BH);var IH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LH=function(t,e){return function(i,n){e(i,n,t)}};const OH=new Ts;let FH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=KT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||rn(r,!0)&&0!==r||en(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;OH.setValue(i.x1,i.y1,i.x2,i.y2),OH.expand(-r/2),h=!OH.containsPoint(e)}}return n.highPerformanceRestore(),h}};FH=IH([qw(),LH(0,Qw(wI)),DH("design:paramtypes",[Object])],FH);var zH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jH=function(t,e){return function(i,n){e(i,n,t)}};let NH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};NH=zH([qw(),jH(0,Qw(gI)),HH("design:paramtypes",[Object])],NH);var VH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let GH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=jT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};GH=VH([qw(),UH(0,Qw(mI)),WH("design:paramtypes",[Object])],GH);var YH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XH=function(t,e){return function(i,n){e(i,n,t)}};let KH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};KH=YH([qw(),XH(0,Qw(bI)),$H("design:paramtypes",[Object])],KH);var qH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JH=function(t,e){return function(i,n){e(i,n,t)}};let QH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=JT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};QH=qH([qw(),JH(0,Qw(kI)),ZH("design:paramtypes",[Object])],QH);var tj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ej=class{constructor(){this.type="text",this.numberType=QT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};ej=tj([qw()],ej);var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sj=function(t,e){return function(i,n){e(i,n,t)}};let rj=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=$T}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=jM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};rj=ij([qw(),sj(0,Qw(SI)),nj("design:paramtypes",[Object])],rj);var aj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lj=function(t,e){return function(i,n){e(i,n,t)}};let hj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};hj=aj([qw(),lj(0,Qw(EI)),oj("design:paramtypes",[Object])],hj);var cj=new Gw((t=>{t(BH).toSelf().inSingletonScope(),t(hL).toService(BH),t(yL).toService(hL),t(FH).toSelf().inSingletonScope(),t(uL).toService(FH),t(yL).toService(uL),t(NH).toSelf().inSingletonScope(),t(oL).toService(NH),t(yL).toService(oL),t(GH).toSelf().inSingletonScope(),t(lL).toService(GH),t(yL).toService(lL),t(KH).toSelf().inSingletonScope(),t(cL).toService(KH),t(yL).toService(cL),t(TH).toSelf().inSingletonScope(),t(dL).toService(TH),t(yL).toService(dL),t(QH).toSelf().inSingletonScope(),t(pL).toService(QH),t(yL).toService(pL),t(ej).toSelf().inSingletonScope(),t(gL).toService(ej),t(yL).toService(gL),t(rj).toSelf().inSingletonScope(),t(fL).toService(rj),t(yL).toService(fL),t(hj).toSelf().inSingletonScope(),t(mL).toService(hj),t(hj).toService(mL),aA(t,yL)}));var dj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new UD(t))).whenTargetNamed(UD.env),t(Kk).toDynamicValue((()=>(t,e)=>new jD(t,e))).whenTargetNamed(jD.env)})),uj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new BO(t))).whenTargetNamed(BO.env),t(Kk).toDynamicValue((()=>(t,e)=>new TO(t,e))).whenTargetNamed(TO.env)})),pj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new SO(t))).whenTargetNamed(SO.env),t(Kk).toDynamicValue((()=>(t,e)=>new _O(t,e))).whenTargetNamed(_O.env)})),gj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new VO(t))).whenTargetNamed(VO.env),t(Kk).toDynamicValue((()=>(t,e)=>new zO(t,e))).whenTargetNamed(zO.env)})),fj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new hF(t))).whenTargetNamed(hF.env),t(Kk).toDynamicValue((()=>(t,e)=>new rF(t,e))).whenTargetNamed(rF.env)})),mj=new Gw((t=>{t(Xk).toDynamicValue((()=>t=>new QO(t))).whenTargetNamed(QO.env),t(Kk).toDynamicValue((()=>(t,e)=>new KO(t,e))).whenTargetNamed(KO.env)}));Yk.load(vE),Yk.load(BL),Yk.load(fD),Yk.load(PL),Yk.load(HL),function(t){t.load(hO),t.load(fF),t.load(mF),t.load(kF)}(Yk),function(t){t.load(mz)}(Yk),function(t){t.load(AH),t.load(cj)}(Yk),function(t){t.load(dj),t.load(pj),t.load(uj),t.load(gj),t.load(fj),t.load(mj)}(Yk);const yj=Yk.get(cA);$k.global=yj;const _j=Yk.get(yE);$k.graphicUtil=_j;const vj=Yk.get(mE);$k.transformUtil=vj;const bj=Yk.get(tE);$k.graphicService=bj,Yk.get(PD);const xj=Yk.get(_E);$k.layerService=xj;class Sj{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,$k.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),$k.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){$k.graphicService.hooks.onAttributeUpdate.taps=$k.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.onSetStage.taps=$k.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class wj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class Aj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,$k.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),$k.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){$k.graphicService.hooks.onAddIncremental.taps=$k.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.onClearIncremental.taps=$k.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,$k.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const kj=new Ts;class Mj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=NM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),$k.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(kj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(kj,t.parent&&t.parent.globalTransMatrix)))})),$k.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),$k.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){$k.graphicService.hooks.beforeUpdateAABBBounds.taps=$k.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.afterUpdateAABBBounds.taps=$k.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),$k.graphicService.hooks.onRemove.taps=$k.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Cj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===lC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=lC.INITIAL,$k.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),$k.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:oC},{mode:"timeout",cons:aC},{mode:"manual",cons:rC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==lC.INITIAL&&(this.status=lC.PAUSE,!0)}resume(){return this.status!==lC.INITIAL&&(this.status=lC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===lC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===lC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=lC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=lC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Cj.addTimeline(cC),Cj.setFPS(60);class Tj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=aT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=_s(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=ms(fs((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=tn(e)?aT.get(e).value:e;const r=this.colorRgb;return aT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const Ej="white";class Rj extends nE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Ej}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new zM,this.hooks={beforeRender:new lA(["stage"]),afterRender:new lA(["stage"])},this.global=Yk.get(cA),this.window=Yk.get(pE),this.renderService=Yk.get(pD),this.pickerService=Yk.get(MD),this.pluginService=Yk.get(DL),this.layerService=Yk.get(_E),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Ts,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Ej,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new tC({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Cj,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new Tj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new LD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new wj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new Sj))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Aj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Cs;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new Mj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.afterDraw((t=>{t.removeAllChild()}))}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new As(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Yk.get(pE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Pj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Pj||(Pj={}));const Bj="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Ij=Bj,Dj=14,Lj=18,Oj=4,Fj={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Dj}}},zj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Dj}}},Hj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Dj,offset:12,position:"outside"}}},jj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Dj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Dj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Dj,fill:"#707070",textBaseline:"middle"}}},Nj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Dj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Dj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Dj,fill:"#707070",textBaseline:"middle"}}},Vj="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",Wj={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:Vj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Vj,fill:"#ddd"}}},Uj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Dj}}},Gj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Yj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Dj,fontWeight:"normal",fillOpacity:1}}},$j={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Dj}}},Xj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Dj}}},Kj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Dj}}},qj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Dj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Dj}}},Zj={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Dj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Dj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Dj,textBaseline:"middle",textAlign:"center"}}},Jj="__VCHART",Qj=500,tN=500,eN=`${Jj}_LABEL_LIMIT`,iN=`${Jj}_LABEL_ALIGN`,nN=`${Jj}_LABEL_TEXT`,sN=`${Jj}_LABEL_VISIBLE`,rN=`${Jj}_LABEL_X`,aN=`${Jj}_LABEL_Y`,oN=`${Jj}_ARC_RATIO`,lN=`${Jj}_ARC_START_ANGLE`,hN=`${Jj}_ARC_END_ANGLE`,cN=`${Jj}_ARC_K`,dN=`${Jj}_ARC_LABEL_HOVER_AX`,uN=`${Jj}_ARC_LABEL_HOVER_AY`,pN=`${Jj}_ARC_LABEL_POINT_AX`,gN=`${Jj}_ARC_LABEL_POINT_AY`,fN=`${Jj}_ARC_LABEL_POINT_BX`,mN=`${Jj}_ARC_LABEL_POINT_BY`,yN=`${Jj}_ARC_LABEL_POINT_CX`,_N=`${Jj}_ARC_LABEL_POINT_CY`,vN=`${Jj}_ARC_LABEL_SELECTED_AX`,bN=`${Jj}_ARC_LABEL_SELECTED_AY`,xN=`${Jj}_ARC_MIDDLE_ANGLE`,SN=`${Jj}_ARC_QUADRANT`,wN=`${Jj}_ARC_RADIAN`,AN=-Math.PI/2,kN=3*Math.PI/2,MN=-90,CN=270,TN=.6,EN={},RN=[],PN=(t,e,i)=>{EN[t]=Object.assign(e,{type:t}),i||RN.push(t)},BN=()=>{RN.slice().forEach((t=>{(t=>{delete EN[t];const e=RN.indexOf(t);e>=0&&RN.splice(e,1)})(t)}))};function IN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:tn(t)?t:Xi(s=t)?null:s.fname})):null}function DN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function LN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const ON=":vGrammar_identifier:";function FN(t,e){return Cn(t).reduce(((t,i)=>{const n=tn(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function zN(t,e){if(Xi(t))return[];if(!$i(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(tn(i))return Cn(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!$i(t)&&!!(null==t?void 0:t.callback)}(t))return FN(t.dependency,e);var i;return[]}function HN(t){return $i(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function jN(t,e,i,n){if(Xi(t))return t;if($i(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return tn(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function NN(t,e){return VN(t)?t.output():e[t]}const VN=t=>t&&!Xi(t.grammarType),WN=t=>$i(t)?t:e=>e[t],UN=t=>tn(t)&&Ws.parseColorString(t)?t:null;function GN(t){return!!(null==t?void 0:t.scale)}function YN(t){return!!(null==t?void 0:t.field)}function $N(t,e){if(!t)return[];let i=[];return t.scale&&(i=VN(t.scale)?[t.scale]:Cn(e.getScaleById(t.scale))),i.concat(zN(t,e))}class XN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return tn(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Cn(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const KN={},qN=t=>KN[t],ZN=(t,e,i,n,s)=>(KN[t]=new XN(e,i,n,s),KN[t]);function JN(t){return null===t?0:t}function QN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const tV=["fillOpacity","x","y","dx","dy"],eV=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=JN(i.x),["x"]):"y"===e?(t.y=JN(i.y),["y"]):"dx"===e?(t.dx=JN(i.dx),["dx"]):"dy"===e?(t.dy=JN(i.dy),["dy"]):[]};var iV,nV,sV,rV,aV,oV,lV,hV,cV,dV,uV,pV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(iV||(iV={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(nV||(nV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(sV||(sV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(rV||(rV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(aV||(aV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(oV||(oV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(lV||(lV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(hV||(hV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(cV||(cV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(dV||(dV={})),function(t){t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd"}(uV||(uV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(pV||(pV={}));const gV={[nV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[nV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;an(e.width)||!an(e.x1)&&an(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):an(e.x1)||!an(e.width)&&an(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),an(e.height)||!an(e.y1)&&an(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):an(e.y1)||!an(e.height)&&an(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;an(e.width)||!an(e.x1)&&an(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):an(e.x1)||!an(e.width)&&an(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),an(e.height)||!an(e.y1)&&an(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):an(e.y1)||!an(e.height)&&an(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),an(e.length)||!an(e.z1)&&an(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):an(e.z1)||!an(e.length)&&an(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[nV.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[nV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return an(e)&&an(i)&&an(n)&&an(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[nV.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const fV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=tn(t)?gV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(tV.includes(r)?eV(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{tV.includes(t)?eV(s,t,e):s[t]=e[t]}));return s},mV=(t,e,i)=>!(!Xi(t)||!Xi(e))||!Xi(t)&&!Xi(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(tn(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function yV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case nV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case nV.group:case nV.rect:case nV.image:return["width","height","y1"].includes(e);case nV.path:case nV.shape:return["path","customPath"].includes(e);case nV.line:return"defined"===e;case nV.area:return["x1","y1","defined"].includes(e);case nV.rule:return["x1","y1"].includes(e);case nV.symbol:return"size"===e;case nV.polygon:return"points"===e;case nV.text:return"text"===e}return!1}function _V(t,e,i,n,s){i&&(HN(i)?e.forEach((e=>{const s=jN(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=s&&!yV(t.mark.markType,r)?[e[0]]:e;if(GN(l)){const t=NN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!Xi(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=tn(null==l?void 0:l.field),c=s?dl(l.field):null;let d=s?null:Xi(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((n=>{var a;s&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(n.datum))),n.nextAttrs[r]=rn(d)||rn(i)?d+e+i:d}))}else if(YN(l)){const t=dl(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=jN(l,n,e.datum,t)}))})))}function vV(t,e,i,n){if(!t)return null;if(HN(t))return jN(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(GN(h)){const t=NN(h.scale,n),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!Xi(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=tn(null==h?void 0:h.field),u=d?dl(h.field):null,p=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,u(e)):Xi(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);s[r]=rn(p)||rn(c)?p+i+c:p}else if(YN(h)){const t=dl(h.field);s[r]=t(e)}else s[r]=jN(h,n,e,i)})),s}function bV(t){if(t)return t.type===jl.Band?t.bandwidth():t.type===jl.Point?t.step():void 0}const xV={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=$i(i)?i:ml(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!Xi(s)){if(Xi(t))return;t[s]=e}return e})),e;const r=n(e,i);return Xi(s)||Xi(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=ll();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=dl(a),h=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),c=Xi(t.default)?null:t.default,d=s.map((t=>dl(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),Xi(n)&&(n=o);const t=o.map((t=>dl(t)));return e.map((e=>d.reduce(((i,s,r)=>{const a=h[s(e)],l=o.length;return(Xi(a)?t.map((t=>c)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>d.reduce(((e,i,s)=>{const r=h[i(t)];return e[n[s]]=Xi(r)?c:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=IN(i,t.as||[]),s=i.map((t=>tn(t)?dl(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Bn(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],b=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),b=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),x=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),S=an(x*_)?x/_:null,w=an(_*_)?_/b:null;return d&&(y[d]=b),p&&(y[p]=x),r&&(y[r]=S),a&&(y[a]=0===i?1:w),o&&(y[o]=!0===g?S:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:x/v[1]),c&&(y[c]=0===i?1:b/v[1]),u&&(y[u]=_),y}));return b},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=DN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=LN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return LN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;Xi(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=Xi(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=Xi(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{Xi(n[ON])&&(n[ON]=0);let s=n[ON];const r=t.as;return e.forEach((t=>{t&&Xi(t[r])&&(s+=1,t[r]=s)})),n[ON]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=bV(a.y),l="y"===t.dodgeChannel||Xi(t.dodgeChannel)&&o>0?"y":"x",h="y"===l?o:bV(a.x);if(h>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!Xi(t.dodgeBy)){const e=nl(Cn(t.dodgeBy));o=t=>e(t.getDatum())}const c=[];e.forEach((t=>{const e=o(t);c.includes(e)||c.push(e)}));const d=c.length;if(d<1)return e;const u=vl(a,h);let p=u>=h?h:h-u;const g=vl(i,p);let f=(p-Math.max(d-1,0)*g)/d;f>t.maxWidth?(p-=(f-t.maxWidth)*d,f=t.maxWidth):f{m[t]=-p/2+e*(f+g)}));const y=r.markType;"rect"===y||"interval"===y?e.forEach((t=>{const e=o(t),i=m[e],n=t.getItemAttribute();if("x"===l){const e={x:(Xi(n.width)&&!Xi(n.x1)?Math.min(n.x,n.x1):n.x)+(Xi(n.width)?Xi(n.x1)?h:Math.abs(n.x1-n.x):n.width)/2+i};Xi(n.width)?e.x1=e.x+f:e.width=f,t.setItemAttributes(e)}else if("y"===l){const e={y:(Xi(n.height)&&!Xi(n.y1)?Math.min(n.y,n.y1):n.y)+(Xi(n.height)?Xi(n.y1)?h:Math.abs(n.y1-n.y):n.height)/2+i};Xi(n.height)?e.y1=e.y+f:e.height=f,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=m[e];if("x"===l){const e=t.getItemAttribute("x")+h/2;t.setItemAttributes({x:e+i+f/2})}else if("y"===l){const e=t.getItemAttribute("y")+h/2;t.setItemAttributes({y:e+i+f/2})}}))}return e},markPhase:"afterEncodeItems"}},SV="__vgrammar_scene_item__",wV=[nV.line,nV.area],AV=[nV.arc3d,nV.rect3d,nV.pyramid3d],kV="key",MV=[{}],CV=["key"],TV="VGRAMMAR_IMMEDIATE_ANIMATION",EV=0,RV=1e3,PV=0,BV=!1,IV=!1,DV="quintInOut",LV={stopWhenStateChange:!1,immediatelyApply:!0},OV={},FV=t=>OV[t],zV=(t,e)=>{OV[t]={creator:e}};class HV extends nE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new mk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Ok.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new mk;let a,o;r.clear();const l=rn(s)?s:fs(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(uV.BEFORE_CREATE_VRENDER_MARK),e===nV.largeRects)return new HV(i);if(e===nV.largeSymbols)return new jV(i);const n=NV[e]?NV[e](i):FV(e)?FV(e).creator(i):null;return t.emit(uV.AFTER_CREATE_VRENDER_MARK),n}function WV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(uV.BEFORE_CREATE_VRENDER_MARK);const n=new eP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=NV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(uV.AFTER_CREATE_VRENDER_MARK),n}const UV=t=>{t&&(t[SV]=null,t.release(),t.parent&&t.parent.removeChild(t))};class GV{constructor(t){this.data=null,this.states=[],this.diffState=iV.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if($i(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));_V(this,o,a,this.mark.parameters());const l=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=l):this.graphicItem.states={[t]:l},l},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[SV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?fV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;Xi(t.clip)||this.graphicItem.setAttribute("clip",t.clip),Xi(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),Xi(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===iV.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(uV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=WN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(uV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=Cn(jN(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===iV.unChange&&(this.diffState=iV.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==iV.enter&&this.diffState!==iV.update||!this.states.length||this.useStates(this.states),this.mark.markType===nV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new mk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===iV.enter?(r&&_V(this,t,r,i,o),s&&_V(this,t,s,i,o)):this.diffState===iV.update?(n&&r&&_V(this,t,r,i,o),s&&_V(this,t,s,i,o)):this.diffState===iV.exit&&a&&_V(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=Yi(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=Cn(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&tn(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=Cn(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(uV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=Yi(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(uV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)_l(n,i,t)&&fn(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=null==l?void 0:l.nextAttrs;if(t&&t.length&&Xi(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||QN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[nV.line,nV.area,nV.largeRects,nV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),c=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),d=t.map((t=>t.nextAttrs)),u=this.mark.isProgressive();if(h=Object.assign({},h),delete h.x,delete h.y,e===nV.line||e===nV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>QN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=JN(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=JN(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=JN(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=JN(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===nV.area);if(c&&!u){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>mV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=fV(nV.line,t.attrs,i);return n.points=e.slice(t.startIndex,Xi(t.endIndex)?e.length:t.endIndex),n})):null}(d,t,this);e?Object.assign(h,{segments:e,points:null}):Object.assign(h,{points:t,segments:null})}else u?Object.assign(h,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(h,{points:s,segments:null})}else e===nV.largeRects?h.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=JN(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=JN(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=JN(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=JN(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===nV.largeSymbols&&(h.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=JN(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=JN(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return h}applyGraphicAttributes(t){if(!un(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!Xi(e=pn(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return pn(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!fn(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!fn(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(UV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(UV(this.graphicItem),this.graphicItem[SV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?Xi(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):Xi(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?en(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const YV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(an(e.center.x)&&(s.x=e.center.x),an(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},$V=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),XV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const KV=["visible","path","text","lineWidth","textBaseline","textAlign"],qV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=an(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=an(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=an(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=an(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=Un(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:an(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=Un(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:an(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),h=t.getGraphicItem().attribute.x,c=t.getGraphicItem().attribute.y,d=t.getGraphicItem().attribute.width,u=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:h+d/2,x1:h+d/2,width:Xi(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:c+u/2,y1:c+u/2,height:Xi(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:h+d/2,x1:h+d/2,y:c+u/2,y1:c+u/2,width:Xi(o)?void 0:0,height:Xi(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:Xi(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:Xi(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:Xi(n)?void 0:0,height:Xi(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:Xi(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:Xi(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:Xi(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:Xi(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:Xi(n)?void 0:0}}:{to:{x:s,x1:s,width:Xi(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:Xi(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:Xi(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:Xi(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:Xi(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:Xi(n)?void 0:0}}:{to:{y:s,y1:s,height:Xi(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=rn(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=rn(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=rn(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:YV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:YV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:$V(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:$V(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:XV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:XV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=rn(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return KV.forEach((t=>{delete n[t],delete s[t]})),Cn(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{_l(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},ZV=Object.assign({},qV),JV=t=>ZV[t],QV=(t,e)=>{ZV[t]=e},tW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!an(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return an(d)&&(m.from.min=l,m.to.min=d),an(u)&&(m.from.max=l,m.to.max=u),an(p)&&(m.from.q1=l,m.to.q1=p),an(g)&&(m.from.q3=l,m.to.q3=g),an(f)&&(m.from.median=l,m.to.median=f),m},eW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!an(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return an(d)&&(m.to.min=l,m.from.min=d),an(u)&&(m.to.max=l,m.from.max=u),an(p)&&(m.to.q1=l,m.from.q1=p),an(g)&&(m.to.q3=l,m.from.q3=g),an(f)&&(m.to.median=l,m.from.median=g),m},iW=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(an(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return an(f)?f:an(_)&&an(v)?(_+v)/2:an(m)&&an(y)?(m+y)/2:an(y)?y:an(m)?m:NaN},nW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(an(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),an(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(an(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),an(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const sW=(t,e,i)=>{var n,s,r,a;if(an(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return an(o)?o:an(c)&&an(d)?(c+d)/2:an(l)&&an(h)?(l+h)/2:an(h)?h:an(l)?l:NaN},rW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(an(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),an(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(an(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),an(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const aW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},oW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},lW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?oW:aW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},hW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{Xi(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},cW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{Xi(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},dW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{Xi(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function uW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(kV,i?t.slice().sort(i):t.slice()),{keys:CV,data:n};const s=WN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class pW{constructor(t,e,i){this.prevData=uW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const gW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{Xi(i[t])&&delete i[t]}));const n=QN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{Xi(i[t])&&delete i[t]}));const n=QN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const fW=(t,e,i,n,s)=>$i(i)?i(t.getDatum(),t,s):i;class mW extends dC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class yW extends dC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{Xi(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:EA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:EA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}pC.mode|=PA.SET_ATTR_IMMEDIATELY;let _W=0;const vW=t=>!Xi(t)&&t.prototype instanceof dC;class bW{constructor(t,e,i){this.id=_W++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),an(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=$i(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!JV(e.type))return null;const r=JV(e.type)(t,s,i);return gW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return en(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):qi(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!Xi(null===(r=s[i])||void 0===r?void 0:r.from),l=!Xi(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?fW(t,0,s[i].from,0,n):void 0,e.to[i]=l?fW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),gW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),l=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const h=vW(o);return Xi(o)||vW(o)?h?new o(a.from,a.to,r,t.easing,l):a.to?new yW(a.from,a.to,r,t.easing):void 0:new mW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!Xi(t)));1===e.length?t.play(e[0]):t.play(new HC(r,e))}}}function xW(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(SW(i,t[i]))})),e}function SW(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Cn(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,h,c,d;if(Xi(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:EV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:IV,loop:null!==(n=l.loop)&&void 0!==n?n:BV,controlOptions:xn({},LV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:RV,delay:null!==(a=l.delay)&&void 0!==a?a:PV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:DV,customParameters:l.customParameters,options:l.options}]}]}}const u=Cn(t.timeSlices).filter((t=>t.effects&&Cn(t.effects).filter((t=>t.channel||t.type)).length));if(u.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:EV,totalTime:t.totalTime,oneByOne:null!==(h=t.oneByOne)&&void 0!==h?h:IV,loop:null!==(c=t.loop)&&void 0!==c?c:BV,controlOptions:xn({},LV,null!==(d=t.controlOptions)&&void 0!==d?d:{}),timeSlices:u.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:PV,effects:Cn(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:DV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function wW(t,e,i){return $i(t)?t.call(null,e.getDatum(),e,i):t}class AW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!Xi(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class kW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=xW(null!=e?e:{})}updateConfig(t){this.configs=xW(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==iV.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new AW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=SW(TV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new AW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return Xi(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=Cn(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Cn(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Cn(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===iV.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(Xi(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},o),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new bW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===iV.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(uV.ANIMATION_START,d),this.mark.emit(uV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=jN(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=wW(t.startTime,e,s),o=wW(t.totalTime,e,s),l=wW(t.oneByOne,e,s),h=wW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=wW(t.delay,e,s),l=null!==(i=wW(t.duration,e,s))&&void 0!==i?i:o/n,h=Cn(t.effects).map((t=>Object.assign({},t,{customParameters:wW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=rn(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:rn(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===iV.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===iV.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===TV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===iV.exit&&0===a[iV.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(uV.ANIMATION_END,h),this.mark.emit(uV.ELEMENT_ANIMATION_END,h,i)}}const MW=(t,e)=>VN(t)?t.output():t&&qi(t)?$i(t.callback)?i=>t.callback(i,e):$i(t.value)?t.value(e):t:t,CW=(t,e)=>t?qi(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=MW(s,e),i}),{}):t.map((t=>MW(t,e))):t;var TW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let EW=-1;class RW extends Ui{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++EW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Cn(this.spec.dependency).map((t=>tn(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Cn(t).map((t=>tn(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return Cn(t).filter((t=>!Xi(t))).forEach((i=>{var n;Xi(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Cn(t).filter((t=>!Xi(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return Xi(this.spec[e])||this.detach(zN(this.spec[e],this.view)),this.spec[e]=t,this.attach(zN(t,this.view)),this.commit(),this}}const PW=(t,e,i)=>{var n,s;if("callback"===t&&$i(e))return{references:[],value:{callback:e,dependency:[]}};if(!Xi(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!Xi(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!Xi(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=zN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},BW=(t,e)=>{const i=(n=t.type,EN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(FN(a,e))));const o=((t,e,i)=>{if(Xi(e))return{value:e};if(en(e)){const n=e.map((e=>PW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return PW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},IW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=BW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class DW extends GV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if($i(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return _V(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[SV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?fV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(uV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=Yi(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(uV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===iV.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==iV.enter&&this.diffState!==iV.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!Xi(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===iV.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=fV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{fn(this.items[0].nextAttrs,e)||fn(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=gV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{fn(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===nV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return wV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&fn(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),fn(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),fn(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)_l(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[SV]=null})),this.glyphGraphicItems=null),super.release()}}const LW=t=>t.markType===nV.glyph?new DW(t):new GV(t);function OW(t){return Xi(t.offsetX)?Xi(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function FW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return an(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),an(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&an(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&an(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const zW="window",HW="view",jW={trap:!1},NW="default",VW="width",WW="height",UW="viewWidth",GW="viewHeight",YW="padding",$W="viewBox",XW="autoFit";function KW(t,e,i,n,s){if(s===zW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{FW(t,OW(t),!1)}))}));const e=OW(t);FW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var qW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class ZW extends RW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new kW(this,{}),this.differ=new pW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=tn(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=tn(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!Xi(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===iV.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===dV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:MV,e);let n=i;i.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(uV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(uV.AFTER_MARK_JOIN),this.emit(uV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(uV.AFTER_MARK_STATE),this.emit(uV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(uV.AFTER_MARK_ENCODE)}return this.emit(uV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(uV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>Xi(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return qW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,Xi(t)||(tn(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return tn(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];HN(i)?this.detach($N(i,this.view)):tn(e)?this.detach($N(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach($N(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return tn(e)?(this.spec.encode[t][e]=i,this.attach($N(i,this.view))):HN(e)?(this.spec.encode[t]=e,this.attach($N(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach($N(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=IW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=IW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{Xi(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{Xi(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return wV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!Xi(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===iV.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];HN(s)||Object.keys(s).forEach((t=>{GN(s[t])&&(e[t]=NN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[SV];if((null==n?void 0:n.mark)===this){const i=KW(this.view,t,n,e,HW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new kW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=NN(this.spec.group,e);this.group=t,t&&(this.emit(uV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(uV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==nV.group){if(!this.graphicItem){const t=VV(this,nV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||AV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==nV.group?(Xi(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),Xi(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=WN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>kV),a=WN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>kV),o=this.spec.sort,l=this.spec.groupSort,h=this.isCollectionMark(),c=new Set(this.elements.filter((t=>t.diffState===iV.enter))),d=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(Xi(e))s=this.elementMap.get(n),s&&(s.diffState=iV.exit);else if(Xi(i)){s=this.elementMap.has(n)?this.elementMap.get(n):LW(this),s.diffState===iV.exit&&(s.diffState=iV.enter,this.animate.getElementAnimators(s,iV.exit).forEach((t=>t.stop("start")))),s.diffState=iV.enter;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),d.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=iV.update;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),d.push(s)}c.delete(s)}));const u=null!=t?t:MV;this.differ.setCurrentData(uW(u,h?a:t=>`${a(t)}-${r(t)}`,h?l:void 0)),this.differ.doDiff(),c.forEach((t=>{this.elementMap.delete(h?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=d,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(uV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(uV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:VV(this,this.markType,t);if(this.emit(uV.BEFORE_ADD_VRENDER_MARK),this.markType===nV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(uV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==nV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=uW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=WN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>kV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=LW(this);e.diffState=iV.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=LW(this);i.diffState=iV.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(HN(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===nV.glyph&&qN(i)){const t=qN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>yV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{yV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(uV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(uV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(yV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(uV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(uV.AFTER_MARK_JOIN),this.emit(uV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(uV.AFTER_MARK_STATE),this.emit(uV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(uV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(uV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(uV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||CV).forEach((t=>{const e=VV(this,nV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(uV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(uV.AFTER_MARK_STATE),this.emit(uV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(uV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==iV.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return gV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=iV.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&UV(this.graphicItem),this.detachAll(),super.release()}}class JW extends ZW{constructor(t,e,i){super(t,nV.component,i),this._componentDatum={[kV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:FV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,kV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[kV]+=1}evaluateJoin(t){return this.spec.key=kV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=tn(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=tn(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const QW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class tU extends nE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){Ji(this.attribute[t])?xn(this.attribute[t],e):this.attribute[t]=e,QW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>QW.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){Xi(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=Kn(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=Kn(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===yj.env?(yj.addEventListener("pointermove",this._onSliderPointerMove),yj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===yj.env?(yj.removeEventListener("pointermove",this._onSliderPointerMove),yj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=qn(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(qn(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Tr(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=Tr(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=qn(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?qn([a+i*s,a+n*s],a,s-l):qn([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new XM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function iU(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&iU(t,e)}))}eU.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const nU=t=>!Xi(t)&&!1!==t.visible,sU=["#ffffff","#000000"];function rU(t,e,i,n,s){const r=hU(t),a=hU(e);return aU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...sU);for(const s of r)if(t!==s&&aU(s,e,i,n))return s}(r,a,i,n,s)}function aU(t,e,i,n){return n?oU(t,e)>n:"largeText"===i?oU(t,e)>3:oU(t,e)>4.5}function oU(t,e){const i=lU(t),n=lU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function lU(t){const e=Gs(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function hU(t){if(null==t?void 0:t.includes("#"))return t;const e=new Ws(t),{r:i,g:n,b:s}=e.color;return"#"+Ys(i,n,s)}function cU(t,e){return[t[0]*e,t[1]*e]}function dU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const uU=-.5*Math.PI,pU=1.5*Math.PI,gU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var fU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(fU||(fU={}));const mU={[fU.selectedReverse]:{},[fU.selected]:{},[fU.hover]:{},[fU.hoverReverse]:{}},yU=(t,e,i)=>new wr(Object.assign({defaultFontParams:{fontFamily:gU,fontSize:11},getTextBounds:i?void 0:xB,specialCharSet:"-/: .,@%'\"~"+wr.ALPHABET_CHAR_SET+wr.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function _U(t,e){var i,n;if(!t)return{width:0,height:0};const s=xB({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var vU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);so&&(g=o,x.setAttribute("maxLineWidth",o-d[1]-d[2])));let E=0,R=0;"center"===C?(E-=g/2,p&&p.setAttribute("x",(p.attribute.x||0)-w/2),u.setAttribute("x",-y/2)):"right"===C||"end"===C?(E-=g,p&&p.setAttribute("x",(p.attribute.x||0)-w),u.setAttribute("x",-d[1]-y)):"left"!==C&&"start"!==C||u.setAttribute("x",d[3]),"middle"===T?(R-=f/2,p&&p.setAttribute("y",0)):"bottom"===T?(R-=f,p&&p.setAttribute("y",-A/2),u.setAttribute("y",-d[2])):"top"===T&&(u.setAttribute("y",d[0]),p&&p.setAttribute("y",A/2));const{visible:P}=s,B=vU(s,["visible"]);if(h&&Yi(P)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},B),{visible:P&&!!e,x:E,y:R,width:g,height:f}),"rect");un(null==c?void 0:c.panel)||(t.states=c.panel)}}}bU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};class xU extends tU{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class SU extends xU{constructor(t){super(xn({},SU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}SU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class wU extends xU{constructor(t){super(xn({},wU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}wU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class AU extends xU{constructor(t){super(xn({},AU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=ks.distancePP(t,e);this.setAttribute("radius",i)}}AU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class kU extends xU{constructor(t){super(xn({},kU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=uU,endAngle:n=pU}=this.attribute,s=n-i,r=Rs(Ds(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}kU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class MU extends xU{constructor(t){super(xn({},MU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=Is(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=ks.distancePP(t,e);this.setAttribute("radius",i)}}MU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const CU=new Uint32Array(33),TU=new Uint32Array(33);TU[0]=0,CU[0]=~TU[0];for(let t=1;t<=32;++t)TU[t]=TU[t-1]<<1|1,CU[t]=~TU[t];function EU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&CU[31&n]&TU[1+(31&s)])return!0}else{if(i[r]&CU[31&n])return!0;if(i[a]&TU[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,CU[31&i]&TU[1+(31&s)]);else for(n(r,CU[31&i]),n(a,TU[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,TU[31&i]|CU[1+(31&n)]);else for(s(r,TU[31&i]),s(a,CU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function RU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=Kn(i,0,t.width),o=Kn(n,0,t.width),l=Kn(s,0,t.height),h=Kn(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function PU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=RU(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function BU(t,e){return!(!t||!e)&&e.encloses(t)}function IU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return IU(t,e,s,l,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?$i(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return IU(t,e,s,r,null===(l=n.overlap)||void 0===l?void 0:l.clampForce)}if("moveX"===i.type){const r=(i.offset?$i(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return IU(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}return!1}const LU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],OU=["top","inside-top","inside"];const FU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function zU(t,e){var i,n;return null!==(n=null===(i=FU[e])||void 0===i?void 0:i.call(FU,t))&&void 0!==n?n:{from:{},to:{}}}const HU="same-time",jU=300,NU="linear";class VU extends tU{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||un(e.states)||(e.addState(fU.hover,!0),iU(this,(t=>{t===e||un(t.states)||t.addState(fU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(iU(this,(t=>{un(t.states)||(t.removeState(fU.hoverReverse),t.removeState(fU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void iU(this,(t=>{un(t.states)||(t.removeState(fU.selectedReverse),t.removeState(fU.selected))}));un(e.states)||(e.addState(fU.selected,!0),iU(this,(t=>{t===e||un(t.states)||t.addState(fU.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!un(e)&&(t.states=e)}_createLabelText(t){const e=gB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if($i(s)&&(s=s({})),!s||0===s.length)return[];let r=[];$i(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],l=this.getBaseMarkGroup(),h=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==l?void 0:l.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==l?void 0:l.AABBBounds.height())&&void 0!==s?s:0};if(0===h.width||0===h.height)return t;const{avoidBaseMark:c,strategy:d=[],hideOnHit:u=!0,clampForce:p=!0}=e,g=this._bmpTool||EU(h.width,h.height),f=this._bitmap||g.bitmap(),m=d.some((t=>"bound"===t.type));c&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&f.setRange(RU(g,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:HU,h=null!==(n=a.duration)&&void 0!==n?n:jU,c=null!==(s=a.easing)&&void 0!==s?s:NU,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=zU(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&an(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new PC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(zU(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==EA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===EA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=rU(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=rU(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=rU(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class WU extends VU{constructor(t){super(xn({},WU.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}WU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class UU extends VU{constructor(t){super(xn({},UU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}UU.tag="rect-label",UU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const GU={rect:UU,symbol:WU};class YU extends tU{constructor(t){super(xn({},YU.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!an(n*i))return;this._componentMap||(this._componentMap=new Map);const s=EU(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function $U(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function XU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=ks.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function KU(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=$U(t,!!s),o=$U(r,!!s);const h=ks.distancePP(n,l),c=ks.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=XU(e,t,!1,!!s),o=XU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=$U(t,!!s),o=$U(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}YU.defaultAttributes={pickable:!1};class qU extends tU{constructor(t){super(xn({},qU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!un(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let l="";if("line"===t||"polygon"===t)l=$U(o,!!n);else if("circle"===t){const{center:t}=this.attribute;l=XU(t,o,!1,!!n)}const h=dB(Object.assign({path:l,z:r},$i(i)?xn({},qU.defaultAttributes.style,i(e,s)):i));h.name=`${this.name}-line`,h.id=this._getNodeId(`path-${a}`),this.add(h)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const l=a[1].x-a[0].x,h=a[1].y-a[0].y,c=Math.sqrt(l*l+h*h),d=r/c;o.push({x:a[0].x+l*d,y:a[0].y+h*d});const u=$U(o,!!n),p=us(o[0].x-o[1].x),g=us(o[0].y-o[1].y),f=dB(Object.assign({path:u,z:0,alpha:p>g?(a[1].x-a[0].x>0?-1:1)*ls/2:0,beta:pg?[o[0].x,0]:[0,o[0].y]},$i(i)?xn({},qU.defaultAttributes.style,i(t,e)):i));f.name=`${this.name}-line`,f.id=this._getNodeId(`path-${s}`),this.add(f)})),e.length>1&&s)){const t=en(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0:i.size)||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};l=[...l.slice(0,l.length-1),n]}const h=cB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),un(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=fB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),un(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var JU,QU;ZU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(JU||(JU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(QU||(QU={}));const tG={[QU.selectedReverse]:{},[QU.selected]:{},[QU.hover]:{},[QU.hoverReverse]:{}},eG={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var iG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!un(e.states)&&(e.addState(fU.hover,!0),iU(this.axisContainer,(t=>{t!==e&&t.name&&!un(t.states)&&t.addState(fU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(iU(this.axisContainer,(t=>{t.name&&!un(t.states)&&(t.removeState(fU.hoverReverse),t.removeState(fU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(fU.selected))return this._lastSelect=null,void iU(this.axisContainer,(t=>{t.name&&!un(t.states)&&(t.removeState(fU.selectedReverse),t.removeState(fU.selected))}));e.name&&!un(e.states)&&(e.addState(fU.selected,!0),iU(this.axisContainer,(t=>{t!==e&&t.name&&!un(t.states)&&t.addState(fU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=yn(this.attribute);xn(this.attribute,t);const i=hB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=hB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,grid:r,items:a,panel:o}=this.attribute,l=hB({x:0,y:0,zIndex:1});if(l.name=JU.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=hB({x:0,y:0,pickable:!1});t.name=JU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=uB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=JU.background,e.id=this._getNodeId("background"),un(o.state)||(e.states=xn({},mU,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){var e;const i=this.getTickLineItems(),n=hB({x:0,y:0,pickable:!1});n.name=JU.tickContainer,n.id=this._getNodeId("tick-container"),t.add(n);const s=un(null===(e=this.attribute.tick)||void 0===e?void 0:e.state)?null:xn({},mU,this.attribute.tick.state);i.forEach(((t,e)=>{const r=cB(Object.assign({},this._getTickLineAttribute("tick",t,e,i)));r.name=JU.tick,r.id=this._getNodeId(t.id),r.states=s,n.add(r)})),this.tickLineItems=i;const{subTick:r}=this.attribute;if(null==r?void 0:r.visible){const t=this.getSubTickLineItems();if(t.length){const e=un(r.state)?null:xn({},mU,r.state);t.forEach(((t,s)=>{const r=cB(Object.assign({},this._getTickLineAttribute("subTick",t,s,i)));r.name=JU.subTick,r.id=this._getNodeId(`${s}`),r.states=e,n.add(r)}))}this.subTickLineItems=t}}renderLabels(t,e,i){var n;const{dataFilter:s}=this.attribute.label;s&&$i(s)&&(e=s(e,i));const r=this._transformItems(e),a=hB({x:0,y:0,pickable:!1});a.name=`${JU.labelContainer}-layer-${i}`,a.id=this._getNodeId(`label-container-layer-${i}`),t.add(a);let o=0,l=0,h="center",c="middle";const d=un(null===(n=this.attribute.label)||void 0===n?void 0:n.state)?null:xn({},mU,this.attribute.label.state);return r.forEach(((t,e)=>{var n;const s=this._getLabelAttribute(t,e,r,i),u=gB(s);u.name=JU.label,u.id=this._getNodeId(`layer${i}-label-${t.id}`),u.states=d,a.add(u);const p=null!==(n=s.angle)&&void 0!==n?n:0;o=Math.max(o,u.AABBBounds.width()),l=Math.max(l,u.AABBBounds.height()),p&&(o=Math.abs(o*Math.cos(p)),l=Math.abs(l*Math.sin(p))),h=s.textAlign,c=s.textBaseline})),this.axisLabelLayerSize[i]={width:o,height:l,textAlign:h,textBaseline:c},a}renderTitle(t){const e=this.getTitleAttribute(),i=new bU(Object.assign({},e));i.name=JU.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return Un(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&$i(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;us(n[0])>us(n[1])?o=ls/2*(l.x>e.x?1:-1):h=ls/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===y[1]?f+=(this.axisLabelLayerSize[n-1].height+pn(this.attribute,"label.space",4))*n:f+=(this.axisLabelLayerSize[n-1].width+pn(this.attribute,"label.space",4))*n);const _=this.getVerticalCoord(t.point,f,u),v=this.getVerticalVector(f,u,_),b=p?p(t.label,t,e,i,n):t.label;let{style:x}=g;return x=$i(x)?xn({},eG.label.style,x(t,e,i,n)):x,x=xn({textAlign:this.getTextAlign(v),textBaseline:this.getTextBaseline(v,u)},x),$i(x.text)&&(x.text=x.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},_),{text:b,lineHeight:null==x?void 0:x.fontSize}),x)}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new qU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${JU.grid}-sub`:`${JU.grid}`,n.id=this._getNodeId(t),e.add(n)}}const sG={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&rG(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function rG(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function aG(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function lG(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=dr(t,i),r=dr(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=cr(t),l=cr(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:hr(t.angle);let f=i?t.angle+hs:hr(90-t.angle);const m=i?e.angle:hr(e.angle);let y=i?e.angle+hs:hr(90-e.angle);f>ds&&(f-=ds),y>ds&&(y-=ds);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(or(s,i)+or(s,n))/2>or(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function hG(t,e){"bottom"!==t&&"top"!==t||function(t,e){let i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var cG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return cU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:h="middle",space:c=4,textStyle:d={},autoRotate:u=!0,shape:p,background:g,state:f}=l,m=cG(l,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===h?y=0:"end"===h&&(y=1);const{verticalFactor:_=1}=this.attribute,v=-1*_,b=this.getTickCoord(y),x=this.getRelativeVector();let S=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+pn(this.attribute,"label.space",4);S+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===x[1])S+=this.axisLabelsContainer.AABBBounds.height()+(e-1)*t;else if(0===x[0])S+=this.axisLabelsContainer.AABBBounds.width()+(e-1)*t;else{Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{S+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const e=this.axisLabelLayerSize[0].textAlign,i="start"===e||"left"===e,n="center"===e,s=x[1]>0;S=1===v?s?i?S:n?S/2:0:i?t:n?S/2:S:s?i?0:n?S/2:S:i?S:n?S/2:0}}let w=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(w=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(w=Math.max(w,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const A=w+S+c,k=this.getVerticalCoord(b,A,!1),M=this.getVerticalVector(A,!1);let C,T,{angle:E}=m;if(C="start"===h?"start":"end"===h?"end":"center",Xi(E)&&u){E=dU(x,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else C=this.getTextAlign(M),T=this.getTextBaseline(M,!1);const R=Object.assign(Object.assign(Object.assign({},k),m),{textStyle:Object.assign({textAlign:C,textBaseline:T},d),state:un(f)?null:{text:f.text,shape:f.shape,panel:f.background}});return R.angle=E,p&&p.visible&&(R.shape=Object.assign({visible:!0},p.style),p.space&&(R.space=p.space)),g&&g.visible&&(R.panel=Object.assign({visible:!0},g.style)),R}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=uU,endAngle:r=pU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}else{n=xn({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(un(t))return;const{verticalLimitSize:o,label:l,title:h,line:c,tick:d,orient:u}=this.attribute,p=null!==(s=l.space)&&void 0!==s?s:4;let g=o,f=0,m=0;const y=(null==c?void 0:c.visible)?null!==(r=c.style.lineWidth)&&void 0!==r?r:1:0,_=(null==d?void 0:d.visible)?null!==(a=d.length)&&void 0!==a?a:4:0;(null==h?void 0:h.visible)&&(f=_U(h.text,h.textStyle).height,m=h.space),g&&(g=(g-p-m-f-y-_)/n);const{layoutFunc:v,autoRotate:b,autoRotateAngle:x,autoLimit:S,limitEllipsis:w,autoHide:A,autoHideMethod:k,autoHideSeparation:M}=l;$i(v)?v(t,e,i,this):(b&&function(t,e){if(un(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Es(e)})),hG(i,t),!lG(t))break}}(t,{labelRotateAngle:x,orient:u}),S&&an(g)&&g>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!un(t)&&an(i)&&t.forEach((t=>{const e=0===t.attribute.angle||Xi(t.attribute.angle)?"top"===s||"bottom"===s?null:i:i/Math.sin(t.attribute.angle);t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:g,ellipsis:w,orient:u}),A&&function(t,e){if(un(t))return;const i=t.filter(oG);if(un(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=$i(s)?s:sG[s]||sG.parity;if(n.length>=3&&aG(n,r)){do{n=a(n,r)}while(n.length>=3&&aG(n,r));n.length<3&&!Tn(i).attribute.opacity&&(n.length>1&&Tn(n).setAttribute("opacity",0),Tn(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:u,method:k,separation:M}))}}dG.defaultAttributes=eG;var uG,pG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=lB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=JU.line,c.id=this._getNodeId("line"),un(null==a?void 0:a.state)||(c.states=xn({},tG,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=uU,endAngle:i=pU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=uU,endAngle:i=pU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Is(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return cU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:h,innerRadius:c=0}=this.attribute,d=this.attribute.title,{space:u=4,textStyle:p={},shape:g,background:f,state:m}=d,y=pG(d,["space","textStyle","shape","background","state"]);let _=l,v=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(v=pn(this.attribute.label,"style.fontSize",12)+pn(this.attribute.label,"space",4));let b=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(b=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(b=Math.max(b,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const x=h+b+v+u;let S="middle",{position:w}=this.attribute.title;Xi(w)&&(w=0===c?"end":"middle"),"start"===w?(S="bottom",_={x:l.x,y:l.y-x}):"end"===w&&(S="top",_={x:l.x,y:l.y+x});const A=Object.assign(Object.assign(Object.assign({},_),y),{textStyle:Object.assign({textBaseline:S,textAlign:"center"},p),state:un(m)?null:{text:m.text,shape:m.shape,panel:m.background}}),{angle:k}=y;return A.angle=k,g&&g.visible&&(A.shape=Object.assign({visible:!0},g.style),g.space&&(A.space=g.space)),f&&f.visible&&(A.panel=Object.assign({visible:!0},f.style)),A}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=xn({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}gG.defaultAttributes=eG;class fG extends dC{constructor(){super(...arguments),this.mode=PA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return iU(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},iU(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!An(t.attribute,o.attribute)){const s=yn(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=an(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=ns.lastIndex=ss.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=ns.exec(t))&&(n=ss.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:es(i,n)})),r=ss.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=uG.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=uG.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=uG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=uG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=uG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===uG.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===uG.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=uG.endHandler):this.state.start=this.state.start+o:this._activeTag===uG.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===yj.env&&(yj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),yj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===uG.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:Kn(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===uG.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:Kn(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===uG.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=yG(t,["formatMethod"]),{formatMethod:s}=e,r=yG(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,xn({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,xn({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,xn({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,xn({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:i,size:n,orient:s,middleHandlerStyle:r}=this.attribute,{width:a,height:o}=n,l=null!==(e=null===(t=null==r?void 0:r.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let h,c,d;return(null==r?void 0:r.visible)?this._isHorizontal?(h=a,c=o-l,d={x:i.x,y:i.y+l}):(h=a-l,c=o,d={x:i.x+("left"===s?l:0),y:i.y}):(h=a,c=o,d=i),this._layoutAttrFromConfig={position:d,width:h,height:c},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:R,end:P}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+R*I,y:B.y,width:(P-R)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+R*D,width:I,height:(P-R)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+R*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(P-R)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(R+P)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+R*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(P-R)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(R+P)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{position:i,size:n,selectedBackgroundChartStyle:s}=this.attribute,{width:r,height:a}=n,{start:o,end:l}=this.state;this.computeBasePoints(),this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?i.x+o*r:i.x,y:this._isHorizontal?i.y:i.y+o*a,width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?i.x+o*r:i.x),y:-(this._isHorizontal?i.y:i.y+o*a),width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==s?void 0:s.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==s?void 0:s.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new bU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;Ki(t)&&Ki(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...Cn(a))}setUpdateStateCallback(t){$i(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){$i(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){$i(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){$i(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){$i(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){$i(t)&&(this._statePointToData=t)}};var vG,bG,xG;_G.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!1,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(vG||(vG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(bG||(bG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xG||(xG={}));class SG extends tU{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=hB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const wG={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:vG.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},AG={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},kG={label:{position:bG.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},MG={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},CG={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};let TG=class t extends SG{constructor(e){super(xn({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},AG[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new ZU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new bU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};TG.defaultAttributes=wG;let EG=class t extends SG{constructor(e){super(xn({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},MG[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=yB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new bU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};EG.defaultAttributes=kG;let RG=class t extends SG{constructor(e){super(xn({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=xG.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},CG[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=fB(Object.assign(Object.assign({},e),n)):"text"===i?o=new bU(Object.assign({},e)):"richText"===i?o=_B(Object.assign(Object.assign({},e),s)):"image"===i?o=mB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new ZU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=cB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};RG.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const PG={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class BG extends tU{getCurrent(){return this._current}constructor(t){super(xn({},BG.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new XM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new XM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(zG.item)){const t=i.delegate;t.hasState(OG.selected)?this._setLegendItemState(t,OG.selectedHover):this._setLegendItemState(t,OG.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===zG.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(FG.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(zG.item)){const t=i.delegate;t.removeState(OG.unSelectedHover),t.removeState(OG.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(OG.unSelectedHover),t.removeState(OG.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===zG.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(FG.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(zG.item)){const t=a.delegate;if(a.name===zG.focus){const e=t.hasState(OG.focus);t.toggleState(OG.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover,OG.focus]),this._setLegendItemState(t,OG.selected)})):(this._setLegendItemState(t,OG.selected),this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[OG.selected,OG.selectedHover,OG.focus]),this._setLegendItemState(e,OG.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(OG.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(OG.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(FG.legendItemClick,t);n?(this._removeLegendItemState(t,[OG.selected,OG.selectedHover]),this._setLegendItemState(t,OG.unSelected)):(this._setLegendItemState(t,OG.selected),this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover]))}else this._setLegendItemState(t,OG.selected),this._removeLegendItemState(t,[OG.unSelected,OG.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[OG.selected,OG.selectedHover]),this._setLegendItemState(e,OG.unSelected))}))}this._dispatchEvent(FG.legendItemClick,t)}}}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,OG.selected),this._removeLegendItemState(e,[OG.unSelected,OG.unSelectedHover])):(this._removeLegendItemState(e,[OG.selected,OG.selectedHover]),this._setLegendItemState(e,OG.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||un(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=hB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:c=[],autoPage:d}=this.attribute,u="horizontal"===o,{spaceCol:p=IG,spaceRow:g=DG,maxWidth:f,width:m,height:y}=t;Ki(f)?Ki(m)?this._itemWidthByUser=Math.min(f,m):this._itemWidthByUser=f:Ki(m)&&(this._itemWidthByUser=m),Ki(y)&&(this._itemHeightByUser=y);let _=!1,v=0,b=0,x=0,S=1,w=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!un(c)||(null==c?void 0:c.includes(t.label)),e),r=i.attribute.width,o=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,o),v=Math.max(r,v),this._itemMaxWidth=Math.max(r,this._itemMaxWidth),u?(S=s,Ki(l)&&(r>=l?(_=!0,e>0&&(b=0,x+=o+g,w+=1)):l0&&i.setAttributes({x:b,y:x}),b+=p+r):(S=n,Ki(h)&&h0&&i.setAttributes({x:b,y:x}),x+=g+o),a.add(i)}));let A=!1;_&&d&&w>S&&(A=this._renderPager(u)),A||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+pn(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i){const{id:n,label:s,value:r,shape:a}=t,{shape:o={},label:l={},value:h={},padding:c=0,background:d,focus:u,focusIconStyle:p={}}=this.attribute.item,g=Tr(c);let f;!1===d.visible?(f=hB({x:0,y:0,cursor:null==d?void 0:d.style.cursor}),this._appendDataToShape(f,zG.item,t,f)):(f=hB(Object.assign({x:0,y:0},null==d?void 0:d.style)),this._appendDataToShape(f,zG.item,t,f,null==d?void 0:d.state)),f.addState(e?OG.selected:OG.unSelected);const m=hB({x:0,y:0,pickable:!1});f.add(m);let y=0;const _=pn(o,"style.size",10),v=pn(o,"space",8),b=fB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},a),o.style));let x;Object.keys(o.state||{}).forEach((t=>{const e=o.state[t].fill||o.state[t].stroke;a.fill&&Xi(o.state[t].fill)&&e&&(o.state[t].fill=e),a.stroke&&Xi(o.state[t].stroke)&&e&&(o.state[t].stroke=e)})),this._appendDataToShape(b,zG.itemShape,t,f,null==o?void 0:o.state),b.addState(e?OG.selected:OG.unSelected),m.add(b);let S=0;if(u){const e=pn(p,"size",10);x=fB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},p),{visible:!1,pickMode:"imprecise",boundsPadding:g})),this._appendDataToShape(x,zG.focus,t,f),S=e}const w=gB(Object.assign(Object.assign({x:_/2+v,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==l?void 0:l.style.fontSize},null==l?void 0:l.style),{text:l.formatMethod?l.formatMethod(s,t,i):s}));this._appendDataToShape(w,zG.itemLabel,t,f,null==l?void 0:l.state),w.addState(e?OG.selected:OG.unSelected),m.add(w);const A=pn(l,"space",8);if(y+=_/2+v+w.AABBBounds.width()+A,Ki(r)){const n=pn(h,"space",u?8:0),s=gB(Object.assign(Object.assign({x:y+A,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==h?void 0:h.style.fontSize},null==h?void 0:h.style),{text:h.formatMethod?h.formatMethod(r,t,i):r}));this._appendDataToShape(s,zG.itemValue,t,f,null==h?void 0:h.state),s.addState(e?OG.selected:OG.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-g[1]-g[3]-_-v-w.AABBBounds.width()-A-S-n),h.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-_/2-g[1]-g[3]-S-n})),y=s.AABBBounds.x2+n,m.add(s)}else this._itemWidthByUser&&w.setAttribute("maxLineWidth",this._itemWidthByUser-g[1]-g[3]-_-v-S);x&&(x.setAttribute("x",y),m.add(x));const k=m.AABBBounds,M=k.width(),C=k.height(),T=this._itemWidthByUser||M+g[1]+g[3],E=this._itemHeightByUser||C+g[0]+g[2];return f.attribute.width=T,f.attribute.height=E,m.translateTo(-k.x1+g[3],-k.y1+g[0]),f}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+pn(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=IG,spaceRow:h=DG}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=LG}=o,f=jG(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new BG(Object.assign({layout:1===r?"horizontal":"vertical",total:99},xn({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new BG(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=hB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==zG.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==zG.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(OG.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=xn({},NG,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new XM(t,{item:e,data:e.data,selected:e.hasState(OG.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}};var WG;function UG(t){return en(t)?t:[t,t]}function GG(t){return t?"ew-resize":"ns-resize"}VG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:IG,spaceRow:DG,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:LG,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(WG||(WG={}));let YG=class t extends tU{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(xn({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===yj.env?(yj.addEventListener("pointermove",this._onHandlerPointerMove),yj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=Kn(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===yj.env)yj.removeEventListener("pointermove",this._onHandlerPointerMove),yj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===yj.env?(yj.addEventListener("pointermove",this._onTrackPointerMove),yj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=Kn(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=Kn(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===yj.env?(yj.removeEventListener("pointermove",this._onTrackPointerMove),yj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,c;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x,c=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,c=i);const d=o/c*(s-n)+n;if(Ki(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,d)}else this._updateHandler(r,o,d);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=Cn(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:h=!0}=this.attribute;let{value:c}=this.attribute;Xi(c)&&(c=[o,l]),this._currentValue={startValue:UG(c)[0],endValue:UG(c)[1]};const d="horizontal"===i;this._isHorizontal=d;const u=hB({x:0,y:0});u.name=WG.innerView,this.add(u),this._innerView=u;let p,g=0;if(r&&r.visible){p=gB(Object.assign({x:d?0:n/2,y:d?s/2:0,textAlign:d?"start":"center",textBaseline:d?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),p.name=WG.startText,u.add(p);const e=Ki(r.space)?r.space:0;g+=(d?p.AABBBounds.width():p.AABBBounds.height())+e}const f=hB({x:d?g:0,y:d?0:g});u.add(f);const m=hB({x:0,y:0});let y;if(m.name=WG.railContainer,this._railContainer=m,f.add(m),this._renderRail(m),g+=d?n:s,a&&a.visible){const t=Ki(a.space)?a.space:0;y=gB(Object.assign({x:d?g+t:n/2,y:d?s/2:g+t,textAlign:d?"start":"center",textBaseline:d?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),y.name=WG.endText,u.add(y)}this._renderTrack(m),h&&(this._renderHandlers(f),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=uB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=WG.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;Xi(c)&&(c=[i,n]);const d=a&&a.visible,u=this._isHorizontal,p=u?l:o,[g,f]=UG(c),m=(g-i)/(n-i)*p,y=this._renderHandler(Object.assign({x:u?m:l/2,y:u?o/2:m,size:s,strokeBoundsBuffer:0,cursor:!1===h?"default":GG(u)},r));if(y.name=WG.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,d){const e=this._renderHandlerText(g);e.name=WG.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(f-i)/(n-i)*p,a=this._renderHandler(Object.assign({x:u?e:l/2,y:u?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===h?"default":GG(u)},r));if(a.name=WG.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f);e.name=WG.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:h}=this.attribute;Xi(h)&&(h=[i,n]);const c=this._isHorizontal,d=c?r:s;let[u,p]=UG(h);e||(u=i);const g=hB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});g.name=WG.trackContainer;const f=qi(e)&&!0===e.draggableTrack;let m;m=!1===l?"default":!1===e||!1===f?"pointer":GG(c);const y=(p-u)/(n-i)*d,_=uB(Object.assign({x:c?(u-i)/(n-i)*d:0,y:c?0:(u-i)/(n-i)*d,width:c?y:r,height:c?s:y,cursor:m},a));_.name=WG.track,this._track=_,g.add(_),t.add(g)}_renderHandler(t){return fB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":GG(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),gB(f)}_bindEvents(){const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),qi(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===WG.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===WG.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===WG.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===WG.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new XM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};YG.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class $G extends HG{constructor(t){super(xn({},$G.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function XG(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}$G.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class KG extends HG{constructor(t){super(xn({},KG.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y,sizeBackground:_}=this.attribute,v=hB({x:0,y:0});this._innerView.add(v);const b=new YG({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:XG(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=dB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+pn(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}KG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};let qG=class t extends tU{constructor(e){super(xn({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,R,P,B,I,D,L,O,F,z,H,j,N,V,W,U,G,Y,$,X,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot;const{text:lt,textStyle:ht,subtext:ct,subtextStyle:dt,width:ut,height:pt,minWidth:gt,maxWidth:ft,minHeight:mt,maxHeight:yt,align:_t,verticalAlign:vt,padding:bt=0}=this.attribute,xt=Tr(bt),St=this.createOrUpdateChild("title-container",{x:xt[3],y:xt[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ht?void 0:ht.visible))if(ht&&Ki(null==ht?void 0:ht.character)){const t={x:null!==(e=ht.x)&&void 0!==e?e:0,y:null!==(i=ht.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ht.width)&&void 0!==n?n:ut)&&void 0!==s?s:0,height:null!==(a=null!==(r=ht.height)&&void 0!==r?r:pt)&&void 0!==a?a:0,ellipsis:null===(o=ht.ellipsis)||void 0===o||o,wordBreak:null!==(l=ht.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ht.maxHeight,maxWidth:ht.maxWidth,textConfig:ht.character};this._mainTitle=St.createOrUpdateChild("mainTitle",t,"richtext")}else Ki(lt)&&(this._mainTitle=St.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[lt]},ht),{maxLineWidth:null!==(h=null==ht?void 0:ht.maxLineWidth)&&void 0!==h?h:ut,heightLimit:null==ht?void 0:ht.heightLimit,lineClamp:null==ht?void 0:ht.lineClamp,ellipsis:null===(c=null==ht?void 0:ht.ellipsis)||void 0===c||c,x:0,y:0}),"wrapText"));const wt=this._mainTitle?null===(d=this._mainTitle)||void 0===d?void 0:d.AABBBounds.height():0,At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.width():0;if(!1!==(null===(p=this.attribute)||void 0===p?void 0:p.visible)&&!1!==(null==dt?void 0:dt.visible))if(dt&&Ki(null==dt?void 0:dt.character)){const t={x:null!==(g=dt.x)&&void 0!==g?g:0,y:null!==(f=dt.y)&&void 0!==f?f:wt,width:null!==(y=null!==(m=dt.width)&&void 0!==m?m:ut)&&void 0!==y?y:0,height:null!==(v=null!==(_=dt.height)&&void 0!==_?_:pt)&&void 0!==v?v:0,ellipsis:null===(b=dt.ellipsis)||void 0===b||b,wordBreak:null!==(x=dt.wordBreak)&&void 0!==x?x:"break-word",maxHeight:dt.maxHeight,maxWidth:dt.maxWidth,textConfig:dt.character};this._subTitle=St.createOrUpdateChild("subTitle",t,"richtext")}else Ki(ct)&&(this._subTitle=St.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[ct]},dt),{maxLineWidth:null!==(S=null==dt?void 0:dt.maxLineWidth)&&void 0!==S?S:ut,heightLimit:null==dt?void 0:dt.heightLimit,lineClamp:null==dt?void 0:dt.lineClamp,ellipsis:null===(w=null==dt?void 0:dt.ellipsis)||void 0===w||w,x:0,y:wt}),"wrapText"));const kt=this._subTitle?null===(A=this._subTitle)||void 0===A?void 0:A.AABBBounds.height():0,Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.width():0;let Ct=Math.max(At,Mt),Tt=wt+(null!==(M=null==dt?void 0:dt.height)&&void 0!==M?M:kt);if(Ki(ut)&&(Ct=ut,null===(C=this._mainTitle)||void 0===C||C.setAttribute("maxLineWidth",ut),null===(T=this._subTitle)||void 0===T||T.setAttribute("maxLineWidth",ut)),Ki(pt)&&(Tt=pt),Ki(gt)&&Ctft&&(Ct=ft)),Ki(mt)&&Ttyt&&(Tt=yt)),St.attribute.width=Ct+xt[1]+xt[3],St.attribute.height=Tt+xt[0]+xt[2],Ki(_t)||Ki(null==ht?void 0:ht.align)){const t=(null==ht?void 0:ht.align)?null==ht?void 0:ht.align:_t,e=null!==(L=null==ht?void 0:ht.width)&&void 0!==L?L:At;"left"===t?(null===(O=this._mainTitle)||void 0===O||O.setAttribute("x",0),null===(F=this._mainTitle)||void 0===F||F.setAttribute("textAlign","left")):"center"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e/2),null===(H=this._mainTitle)||void 0===H||H.setAttribute("textAlign","center")):"right"===t&&(null===(j=this._mainTitle)||void 0===j||j.setAttribute("x",e),null===(N=this._mainTitle)||void 0===N||N.setAttribute("textAlign","right"))}if(Ki(vt)||Ki(null==ht?void 0:ht.verticalAlign)){const t=(null==ht?void 0:ht.verticalAlign)?null==ht?void 0:ht.verticalAlign:vt,e=(null==ht?void 0:ht.height)?null==ht?void 0:ht.height:Ct;"top"===t?(null===(V=this._mainTitle)||void 0===V||V.setAttribute("y",0),null===(W=this._mainTitle)||void 0===W||W.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(Ki(_t)||Ki(null==dt?void 0:dt.align)){const t=(null==dt?void 0:dt.align)?null==dt?void 0:dt.align:_t,e=null!==(X=null==dt?void 0:dt.width)&&void 0!==X?X:Mt;"left"===t?(null===(K=this._subTitle)||void 0===K||K.setAttribute("x",0),null===(q=this._subTitle)||void 0===q||q.setAttribute("textAlign","left")):"center"===t?(null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("x",e/2),null===(J=this._subTitle)||void 0===J||J.setAttribute("textAlign","center")):"right"===t&&(null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("x",e),null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("textAlign","right"))}if(Ki(vt)||Ki(null==ht?void 0:ht.verticalAlign)){const t=(null==dt?void 0:dt.verticalAlign)?null==dt?void 0:dt.verticalAlign:vt,e=wt,i=null!==(et=null==dt?void 0:dt.height)&&void 0!==et?et:0;"top"===t?(null===(it=this._subTitle)||void 0===it||it.setAttribute("y",e),null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("textBaseline","top")):"middle"===t?(null===(st=this._subTitle)||void 0===st||st.setAttribute("y",e+i/2),null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(at=this._subTitle)||void 0===at||at.setAttribute("y",e+i),null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("textBaseline","bottom"))}}};qG.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const ZG={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};let JG=class extends tU{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(Ki(i))if(!1!==i.visible){const t=xn({},pn(ZG,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:Ki(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&an(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&an(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(Ki(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=Cn(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=xn({},pn(ZG,"content.style"),e.style),c=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:Ki(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&an(a)&&this._setAutoFit(a,c,e),e.autoLimit&&an(r)&&c.setAttribute("maxLineWidth",a),s.push(c);const d=(null==e?void 0:e.space)?e.space:0;h+=c.AABBBounds.height()+d}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=_U(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",Ki(i.style.lineHeight)?i.style.lineHeight:s)}}};class QG extends XR{constructor(t){super(t)}}var tY,eY;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(tY||(tY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(eY||(eY={}));class iY extends tU{constructor(t){super(xn({},iY.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},iY.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},iY.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},iY.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},iY.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{Xi(this._playController)&&(this._playController=new QG(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{Xi(this._backwardController)&&(this._backwardController=new QG(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{Xi(this._forwardController)&&(this._forwardController=new QG(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()}))},this._createCustomEvent=t=>{var e;const i=new XM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{const t=this._createCustomEvent(tY.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(tY.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(tY.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(tY.OnBackward);this.dispatchEvent(t)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}iY.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},iY.defaultAttributes={visible:!0,[eY.Start]:{},[eY.Pause]:{},[eY.Backward]:{},[eY.Forward]:{}};const nY={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},sY=[200,10];var rY,aY;!function(t){t.Default="default",t.Reverse="reverse"}(rY||(rY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(aY||(aY={}));const oY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===rY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===rY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},lY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===rY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===rY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},hY=t=>"top"===t||"bottom"===t;class cY extends tU{constructor(t){super(xn({},cY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;an(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=fs(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:an(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(hY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:sY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:sY[1];s.layout="vertical",s.railWidth=e,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new YG(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return hY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new iY(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=hY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:sY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=rn(i)?i:fs(i[0],i[1]);return t+e.space+n}),0),l=(hY(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=rn(s)?s:fs(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:hY(this._orient)?t+n:(this._size.width-r)/2,y:hY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:hY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:hY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=rn(s)?s:fs(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:hY(this._orient)?t+n:(this._size.width-r)/2,y:hY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){var i;const n=new XM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}cY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},nY),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},nY),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},nY),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},nY),{key:"backward",position:"start"})}};class dY extends cY{constructor(t){super(xn({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:rY.Default,this._dataIndex=Xi(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(tY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(tY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(tY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(tY.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(aY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(oY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||lY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===rY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(aY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(aY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(aY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),yj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(aY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,yj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(aY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(aY.OnChange),this.dispatchCustomEvent(aY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(aY.OnChange),this.dispatchCustomEvent(aY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var uY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class pY extends cY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(tY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(tY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(tY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(tY.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,n=i/this._maxIndex;this._elapsed=n*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)}))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(aY.OnChange))},this.play=()=>uY(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(aY.OnPlay),this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=yj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,yj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(aY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,yj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(aY.OnPause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(aY.OnBackward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(aY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const gY={debounce:Qn,throttle:ts};let fY=class t extends tU{constructor(e){super(xn({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",gY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(vr(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:yn(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=yB(Object.assign({points:yn(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return xn(t,...i,{shape:s.every(Xi)?void 0:xn({},...s),key:r.every(Xi)?void 0:xn({},...r),value:a.every(Xi)?void 0:xn({},...a)})},yY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:Cn(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},_Y={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:gU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:gU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:gU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ts).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},vY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let bY=class t extends tU{constructor(e){super(xn({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=Tr(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const c=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",xn({symbolType:"circle"},c.shape,{visible:nU(c)&&nU(c.shape)}),"symbol"),c.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:nU(c)&&nU(c.value)},yY(c.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:nU(c)&&nU(c.value)},c.value),"text");const d=nU(c.shape)?c.shape.size+c.shape.spacing:0,{textAlign:u,textBaseline:p}=c.value,g=n.width-h[3]-h[0]-d;"center"===u?this._tooltipTitle.setAttribute("x",d+g/2):"right"===u||"end"===u?this._tooltipTitle.setAttribute("x",d+g):this._tooltipTitle.setAttribute("x",d),"bottom"===p?this._tooltipTitle.setAttribute("y",c.height):"middle"===p?this._tooltipTitle.setAttribute("y",c.height/2):this._tooltipTitle.setAttribute("y",0);const f=nU(c)?c.height+c.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+f);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!nU(l))return;const h=`tooltip-content-${n}`,c=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let d=0;if(nU(l.shape)&&c.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(d+=l.shape.size+l.shape.spacing),nU(l.key)){let t;t=l.key.multiLine?c.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},yY(l.key)),{textBaseline:"top"}),"richtext"):c.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",d+s/2):"right"===e||"end"===e?t.setAttribute("x",d+s):t.setAttribute("x",d),t.setAttribute("y",0),d+=s+l.key.spacing}if(nU(l.value)){let t;t=l.value.multiLine?c.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},yY(l.value)),{textBaseline:"top"}),"richtext"):c.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";Ki(l.value.textAlign)?e=l.value.textAlign:nU(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",d+r/2):"right"===e||"end"===e?t.setAttribute("x",d+r):t.setAttribute("x",d),d+=r,t.setAttribute("y",0),c.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>vY.includes(t)))?(this._mergeAttributes(e,n),Xi(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&nU(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=nU(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=yU(u),v=yU(p);let b=0;if(nU(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(nU(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&YR[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return mY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return mY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};bY.defaultAttributes=_Y;const xY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class SY extends JW{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=tn(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}zV(aV.lineAxis,((t,e)=>new dG(t,e))),zV(aV.circleAxis,(t=>new gG(t)));class wY extends SY{constructor(t,e,i){super(t,sV.axis,e),this.spec.componentType=sV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=xn({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=FV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=vV(s,e,i,n);const c=jN(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=jN(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=jN(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case aV.lineAxis:return((t,e,i)=>{var n,s;const r=xY.axis;return t?xn({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):xn({},r,null!=e?e:{})})(u,h,p);case aV.circleAxis:return((t,e,i)=>{var n,s;const r=xY.circleAxis;return t?xn({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):xn({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(Xi(e)){const i=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?aV.circleAxis:aV.lineAxis,this._axisComponentType}}zV(oV.discreteLegend,(t=>new VG(t))),zV(oV.colorLegend,(t=>new $G(t))),zV(oV.sizeLegend,(t=>new KG(t)));class AY extends SY{constructor(t,e){super(t,sV.legend,e),this.spec.componentType=sV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==oV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":FG.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=tn(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=tn(t)?this.view.getDataById(t):t,l=tn(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,rV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=FV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=vV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case oV.discreteLegend:return((t,e)=>{const i=xY.discreteLegend;return t?xn({},i,{items:Array.from(new Set(Cn(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=UN(n),r=s?Object.assign(Object.assign({},xY.discreteLegend.items[0].shape),{fill:s,stroke:s}):xY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):xn({},i,null!=e?e:{})})(o,a);case oV.colorLegend:return((t,e)=>{const i=xY.colorLegend;if(!t)return xn({},i,null!=e?e:{});const n=t.domain();return xn({},i,{colors:t.range().slice(),min:n[0],max:Tn(n)},null!=e?e:{})})(o,a);case oV.sizeLegend:return((t,e)=>{const i=xY.sizeLegend;if(!t)return xn({},i,null!=e?e:{});const n=t.domain();return xn({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&Nl(i)){const t=e.getScale().range();UN(null==t?void 0:t[0])?this._legendComponentType=oV.colorLegend:this._legendComponentType=oV.sizeLegend}else this._legendComponentType=oV.discreteLegend}return this._legendComponentType}}zV(lV.lineCrosshair,(t=>new SU(t))),zV(lV.rectCrosshair,(t=>new wU(t))),zV(lV.sectorCrosshair,(t=>new kU(t))),zV(lV.circleCrosshair,(t=>new AU(t))),zV(lV.polygonCrosshair,(t=>new MU(t)));const kY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(Wl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Ps(Ds(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else Nl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Ds(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class MY extends SY{constructor(t,e){super(t,sV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(tn(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case lV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=xY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return xn({},l,kY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case lV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=xY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=kY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=xn({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case lV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=xY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(Wl(e.type)){const i=Ps(Ds(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else Nl(e.type)&&(f=Ds(u,t));return xn({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case lV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=xY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(Wl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else Nl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return xn({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case lV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=xY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(Wl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else Nl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return xn({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=sV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=FV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=vV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?lV.sectorCrosshair:lV.rectCrosshair:"radius"===n?lV.circleCrosshair:"radius-polygon"===n?lV.polygonCrosshair:lV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}zV(sV.slider,(t=>new YG(t)));class CY extends JW{constructor(t,e){super(t,sV.slider,e),this.spec.componentType=sV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=tn(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=tn(t)?this.view.getDataById(t):t,a=tn(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,rV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>xn({},xY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(Xi(this.spec.min)?0:jN(this.spec.min,i,t,e),Xi(this.spec.max)?1:jN(this.spec.max,i,t,e),vV(n,t,e,i))}),e}),{});this._encoders=e}}zV(sV.label,(t=>new YU(t)));let TY=class extends JW{constructor(t,e){super(t,sV.label,e),this.spec.componentType=sV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Cn(this.spec.target).map((t=>tn(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Cn(t).map((t=>tn(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=Cn(this.spec.target).map((t=>tn(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=jN(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=xY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case nV.line:r=xY.lineLabel;break;case nV.rect:r=xY.rectLabel;break;case nV.symbol:r=xY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[SV],n=vV(i,e.getDatum(),e,s),o=xn({},r.data[0],n);a.push(o)}}));const o=jN(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return xn({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!Xi(t)));return xn({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};zV(sV.datazoom,(t=>new _G(t)));class EY extends JW{constructor(t,e){super(t,sV.datazoom,e),this.spec.componentType=sV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!Xi(this.spec.preview)){const t=this.spec.preview.data,e=tn(t)?this.view.getDataById(t):t;this.detach(e),this.detach($N(this.spec.preview.x,this.view)),this.detach($N(this.spec.preview.y,this.view)),this.detach($N(this.spec.preview.x1,this.view)),this.detach($N(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=tn(t)?this.view.getDataById(t):t;this.attach(r),this.attach($N(e,this.view)),this.attach($N(i,this.view)),this.attach($N(n,this.view)),this.attach($N(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=tn(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=tn(t)?this.view.getDataById(t):t,h=tn(e)?(t,i)=>{if(Xi(i.start)||Xi(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,rV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),h),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},xY.datazoom,t),n=FV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=tn(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=vV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=xY.datazoom;return t?xn({},l,{previewData:t,previewXCallback:e?t=>vV({x:e},t,r,a).x:null,previewYCallback:i?t=>vV({y:i},t,r,a).y:null,previewX1Callback:n?t=>vV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>vV({y1:s},t,r,a).y1:null},null!=o?o:{}):xn({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=tn(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}zV(cV.continuousPlayer,(t=>new pY(t))),zV(cV.discretePlayer,(t=>new dY(t)));let RY=class extends JW{constructor(t,e){super(t,sV.player,e),this.spec.componentType=sV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=en(t)?null:tn(t)?this.view.getDataById(t):t;this.detach(e)}const r=en(e)?null:tn(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=tn(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(aY.OnChange,this._filterCallback),this.spec.target=void 0;const l=tn(t)?this.view.getDataById(t):t;return this._filterData(o,l,rV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(aY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=xn({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:FV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=vV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=en(o)?null:tn(o)?this.view.getDataById(o):o,h=en(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>xn({},xY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>xn({},xY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};zV(sV.tooltip,(t=>new bY(t)));let PY=class extends JW{constructor(t,e){super(t,sV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ts(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Ts).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>xn({},xY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=sV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=Cn(this.spec.target).map((t=>tn(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=Cn(t).map((t=>tn(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!Xi(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=vV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return Cn(t).reduce(((t,e)=>(t=t.concat(zN(e.visible,this.view)),YN(e.key)||(t=t.concat(zN(e.key,this.view))),YN(e.value)||(t=t.concat(zN(e.value,this.view))),YN(e.symbol)||(t=t.concat(zN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=jN(t.visible,n,e,i);return o=!!Xi(o)||!!o,s=YN(t.key)?dl(t.key.field)(e):jN(t.key,n,e,i),s=Xi(s)?void 0:Zi(s)?s:{text:s},r=YN(t.value)?dl(t.value.field)(e):jN(t.value,n,e,i),r=Xi(r)?void 0:Zi(r)?r:{text:r},a=YN(t.symbol)?dl(t.symbol.field)(e):jN(t.symbol,n,e,i),a=Xi(a)?void 0:Zi(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?Cn(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var BY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class IY extends RW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],Xi(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=zN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];Cn(t.source).forEach((t=>{const i=VN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return BY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return Xi(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return Xi(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Cn(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=IW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=IW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Cn(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=Cn(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function DY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function LY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,DY(t,e,s,n)}class OY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return DY(this.nodes,e,0,this.compare),LY(this.nodes,e,null,this.compare)}return this.nodes.push(t),DY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),DY(this.nodes,e,0,this.compare),LY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,LY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class FY{constructor(t){this.list=[],this.ids={},this.idFunc=t||ul}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var zY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class HY{constructor(){this.grammars=[],this.logger=ll(),this._curRank=0,this._committed=new FY((t=>t.uid)),this._heap=new OY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return zY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>Xi(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new FY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return zY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const jY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===nV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class NY{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(uV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return DT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{$k.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(uV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Rj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(uV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(uV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(uV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new eC(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=qi(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new sC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class VY extends RW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?jN(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(en(t)&&en(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function JY(t,e,i){jN(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=jN(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),Xi(null==n?void 0:n.clamp)||($i(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function QY(t,e,i){KY(t,e,i),qY(t,e,i),ZY(t,e,i),JY(t,e,i)}function t$(t,e,i){t.round&&e.round(jN(t.round,i,e),!0),t.padding&&e.padding(jN(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(jN(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(jN(t.paddingOuter,i,e),!0),t.align&&e.align(jN(t.align,i,e),!0)}function e$(t,e,i,n){const s=t.field,r=NN(t.data,i),a=tn(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),Nl(e.type)?(n&&a.filter((t=>rn(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function i$(t,e,i){if(UY(t.domain)?e.domain(e$(t.domain,e,i,!0),!0):e.domain(jN(t.domain,i,e),!0),UY(t.range))e.range(e$(t.range,e,i),!0);else if(GY(t.range)){const n=NN(t.range.coordinate,i);!function(t){switch(t){case jl.Quantile:case jl.Quantize:case jl.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(jN(t.range,i,e),!0);switch(t.type){case"linear":QY(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){t$(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){QY(t,e,i);const n=jN(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){KY(t,e,i),ZY(t,e,i),JY(t,e,i);const n=jN(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){QY(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){QY(t,e,i);const n=jN(t.constant,i,e);an(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){KY(t,e,i),ZY(t,e,i),JY(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){KY(t,e,i),qY(t,e,i),ZY(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class n$ extends RW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=WY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=WY(this.spec.type)),i$(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return Xi(this.spec.domain)||this.detach($Y(this.spec.domain,this.view)),this.spec.domain=t,this.attach($Y(t,this.view)),this.commit(),this}range(t){return Xi(this.spec.range)||this.detach($Y(this.spec.range,this.view)),this.spec.range=t,this.attach($Y(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!Xi(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!Xi(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return Xi(e)?null:this.parameters()[e]}configure(t){return this.detach(XY(this.spec.type,t,this.view)),Xi(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(XY(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let s$=-1;const r$=[VW,WW,YW,UW,GW,$W,XW],a$=t=>{var e,i,n,s;return rn(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},o$=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:DV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:PV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:RV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:IV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},l$=(t,e)=>(null==e?void 0:e.debounce)?Qn(t,e.debounce):(null==e?void 0:e.throttle)?ts(t,e.throttle):t,h$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:HW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):NV[t]?(i.markType=t,i.source=e):i.source=t===zW?zW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},c$={},d$=()=>c$;let u$=class extends ZW{constructor(t,e){super(t,nV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return gV.rect}evaluateJoin(t){return super.evaluateJoin(MV)}};function p$(t,e){if(an(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return an(t)?t*e:0}return 0}function g$(t,e){return Math.min(t<0?t+e:t-1,e)}function f$(t,e,i){let n=g$(t,i),s=g$(e,i);if(an(t)||an(e)?an(t)?an(e)||(n=g$(Math.max(0,s-1),i)):s=g$(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const m$=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>p$(t,i))),u=l.map((t=>p$(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=f$(e,i,r),{start:h,end:c}=f$(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Cs).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},y$=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=vl(r.maxChildWidth,s.width()),o=vl(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=a$(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==nV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if($i(r))r.call(null,t,s,a,e);else if($i(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=y$(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(UW,o),i.updateSignal(GW,l),i.updateSignal(YW,h)}else y$(t,s,a,e);else"grid"===r.display&&m$(t,s,a);_$(s,e,i)}))};class v$ extends ZW{constructor(t,e,i){super(t,nV.glyph,i),this.glyphType=e,this.glyphMeta=qN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=WV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let b$=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return Xi(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return Xi(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return en(t)?(i.x=t[0],i.y=t[1]):rn(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new Ls,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class x$ extends b${constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(an(t.x1)||an(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(an(t.x1)||an(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=Xi(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=Xi(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=en(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class S$ extends b${constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Ps(s);const r=Un(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function w$(t){switch(t){case"cartesian":default:return new x$;case"polar":return new S$}}class A$ extends RW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=w$(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=w$(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,h;!Xi(t.start)&&e.start(null!==(n=jN(t.start,i))&&void 0!==n?n:[0,0]),!Xi(t.end)&&e.end(null!==(s=jN(t.end,i))&&void 0!==s?s:[0,0]),!Xi(t.origin)&&e.origin(null!==(r=jN(t.origin,i))&&void 0!==r?r:[0,0]);const c=[];if(!Xi(t.translate)){const e=jN(t.translate,i);c.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!Xi(t.rotate)){const e=jN(t.rotate,i);c.push({type:"rotate",angle:null!=e?e:0})}if(!Xi(t.scale)){const e=jN(t.scale,i);c.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(h=null==e?void 0:e[1])&&void 0!==h?h:1}})}Xi(t.transpose)||jN(t.transpose,i)&&c.push({type:"transpose"}),e.applyTransforms(c)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const k$=Symbol.for("key");class M${diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new pW(t,i);return s.setCallback(((t,e,i)=>{Xi(e)?n.exit.push({prev:i[0]}):Xi(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(uW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==nV.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==nV.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=uW(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=uW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!Xi(e.morphElementKey)){const i=WN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new pW(t,i);return s.setCallback(((t,e,i)=>{Xi(e)?n.exit.push({prev:i}):Xi(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(uW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:k$})),r=uW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:k$}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==k$){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=jN(i.animation.delay,s,o,l),d=jN(i.animation.duration,s,o,l),u=jN(i.animation.oneByOne,s,o,l),p=jN(i.animation.splitPath,s,o,l),g=an(u)&&u>0?t=>rn(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?AT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:kT)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);bT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?AT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:kT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>mT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>_T(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:EA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new vT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:_C,null!==(l=i.easing)&&void 0!==l?l:vC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:EA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new xT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:_C,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:vC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):bT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class C${constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=tn(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),Xi(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),Xi(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),Xi(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),Xi(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class T${constructor(t){this.view=t}stop(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.stop()})),this}pause(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.pause()})),this}resume(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.resume()})),this}enable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.enable()})),this}disable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.disable()})),this}enableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.enableAnimationState(t)})),this}disableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.disableAnimationState(t)})),this}animate(){return this.view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){}}class E$ extends ZW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=HN(e)?null:Object.keys(e).reduce(((t,n)=>(GN(e[n])&&(t[n]=NN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=vV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===jl.Band){if(!Xi(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===jl.Band){if(!Xi(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:gV.rect}addGraphicItem(t,e){const i=VV(this,this.coord&&"polar"===this.coord.output().type?nV.arc:nV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class R$ extends ZW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=HN(e)?null:Object.keys(e).reduce(((t,n)=>(GN(e[n])&&(t[n]=NN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=vV(e,t,i,s);if(Xi(r.size)){const t=n.x?bV(n.x):void 0,e=n.y?bV(n.y):void 0;Xi(t)&&Xi(e)?r.size=10:Xi(t)?r.size=e:Xi(e)&&(r.size=t),r.size=[t,e]}return Xi(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(rn(i.padding)&&i.padding>0)t.size=en(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(en(i.padding)&&2===i.padding.length){const e=en(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(gV.symbol)}release(){super.release(),this._encoders=null}}var P$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class B$ extends Ui{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=Qn((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[SV],s=KW(0,t,n,e,HW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){tn(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new VY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new IY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new n$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new A$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=tn(e)?this.getMarkById(e):e;let s;switch(t){case nV.group:s=new u$(this,n);break;case nV.glyph:s=new v$(this,null==i?void 0:i.glyphType,n);break;case nV.component:s=((t,e,i,n)=>{switch(e){case sV.axis:return new wY(t,i,n);case sV.legend:return new AY(t,i);case sV.crosshair:return new MY(t,i);case sV.slider:return new CY(t,i);case sV.label:return new TY(t,i);case sV.datazoom:return new EY(t,i);case sV.player:return new RY(t,i);case sV.tooltip:return new PY(t,i)}return new JW(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case nV.interval:s=new E$(this,t,n);break;case nV.cell:s=new R$(this,t,n);break;default:s=new ZW(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(nV.group,t)}glyph(t,e){return this.mark(nV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(nV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(nV.component,t,{componentType:sV.axis,mode:e})}legend(t){return this.mark(nV.component,t,{componentType:sV.legend})}crosshair(t){return this.mark(nV.component,t,{componentType:sV.crosshair})}slider(t){return this.mark(nV.component,t,{componentType:sV.slider})}label(t){return this.mark(nV.component,t,{componentType:sV.label})}datazoom(t){return this.mark(nV.component,t,{componentType:sV.datazoom})}player(t){return this.mark(nV.component,t,{componentType:sV.player})}tooltip(t){return this.mark(nV.component,t,{componentType:sV.tooltip})}customized(t,e){const i=(t=>c$[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=tn(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&r$.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(uV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++s$;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(VW,t.width),this.updateSignal(WW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=d$();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(uV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=dV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:VW,value:null!==(i=t[VW])&&void 0!==i?i:0},{id:WW,value:null!==(n=t[WW])&&void 0!==n?n:0},{id:YW,value:a$(null!==(s=t[YW])&&void 0!==s?s:e[YW])},{id:UW,update:{callback:(t,e)=>{const i=a$(e[YW]);return e[VW]-i.left-i.right},dependency:[VW,YW]}},{id:GW,update:{callback:(t,e)=>{const i=a$(e[YW]);return e[WW]-i.top-i.bottom},dependency:[WW,YW]}},{id:$W,update:{callback:(t,e)=>{const i=a$(e[YW]);return(t||new Cs).setValue(i.left,i.top,i.left+e[UW],i.top+e[GW])},dependency:[UW,GW,YW]}},{id:XW,value:null!==(r=t[XW])&&void 0!==r?r:e[XW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===nV.glyph?{glyphType:t.glyphType}:t.type===nV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(VW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(WW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(UW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(GW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(YW);if(arguments.length){const i=a$(t);return this.updateSignal(e,i),i}return a$(e.output())}autoFit(t){const e=this.getSignalById(XW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById($W);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=dV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===nV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||_$;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(uV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(uV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(uV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{jY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(uV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(uV.BEFORE_MARK_RENDER_END),jY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(uV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return P$(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return P$(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(uV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(uV.AFTER_DO_RENDER)}evaluate(t){var e,i;return P$(this,void 0,void 0,(function*(){const n=o$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=dV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=dV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=dV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=o$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=dV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=dV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=dV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!r$.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return jY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=Ha(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return P$(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(VW,t)),e!==this.height()&&(n=!0,this.updateSignal(WW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,h=h$(e);if(!h)return;const{source:c,type:d}=h,u=Xi((m=h).markId)?t=>t&&t.mark.id()===m.markId:Xi(m.markName)?t=>t&&t.mark.name()===m.markName:Xi(m.type)?t=>t&&t.mark.markType===m.type:()=>!0,p=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:tn(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),g=FN(l,this),f=l$(((t,e)=>{const n=c===HW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===zW&&(t=KW(0,t,e,d,zW));let s=!1;if((!i||i(t))&&(!u||u(e))&&p.length){const e=g.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});p.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var m;if(c===HW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||qi(n)&&!n[i])}(this._eventConfig,HW,d))return this.addEventListener(d,f,jW),()=>{this.removeEventListener(d,f)}}else if(c===zW)return yj.addEventListener(d,f),this._eventListeners.push({type:d,source:yj,handler:f}),()=>{yj.removeEventListener(d,f);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===yj&&t.handler===f));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);tn(e)?i.type=e:qi(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:NW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?tn(r)?r:r.user:NW,o=r&&a===r.user&&(s===r.element||Xi(s)&&Xi(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==NW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!Xi(document)&&document.body:this.container;return e?Xi(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new NY(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e,i;this.grammars=new C$((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new C$((t=>t.id())),this._options.logger&&(i=this._options.logger,ol=i),this.logger=ll(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new HY,this.animate=new T$(this),this._morph=new M$,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{en(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[HW,zW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&yj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=dV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==nV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=yj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&yj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),BN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const I$=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{PN(e,t[e],!0)}))}))};I$(xV);const D$=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var L$,O$,F$;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(L$||(L$={})),function(t){t.chart="chart",t.window="window"}(O$||(O$={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(F$||(F$={}));const z$=`${Jj}_waterfall_default_seriesField`,H$=`${Jj}_DEFAULT_DATA_INDEX`,j$=`${Jj}_DEFAULT_DATA_KEY`,N$=`${Jj}_DEFAULT_DATA_SERIES_FIELD`,V$=`${Jj}_DEFAULT_SERIES_STYLE_NAME`;var W$;!function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.Built_In=99]="Built_In"}(W$||(W$={}));const U$=`${Jj}_STACK_START`,G$=`${Jj}_STACK_END`,Y$=`${Jj}_STACK_START_PERCENT`,$$=`${Jj}_STACK_END_PERCENT`,X$=`${Jj}_STACK_START_OffsetSilhouette`,K$=`${Jj}_STACK_END_OffsetSilhouette`,q$=`${Jj}_SEGMENT_START`,Z$=`${Jj}_SEGMENT_END`;var J$,Q$;!function(t){t[t.Axis_Grid=100]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark"}(J$||(J$={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(Q$||(Q$={}));const tX=["linear","radial","conical"],eX={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},iX={innerRadius:0,outerRadius:1,startAngle:MN,endAngle:CN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var nX,sX;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(nX||(nX={})),function(t){t.middle="middle",t.start="start",t.end="end"}(sX||(sX={}));const rX={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,tickSize:Oj,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Oj/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Dj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Dj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},aX={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Dj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},oX={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Dj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},lX={name:"light",padding:12,fontFamily:Ij,colorScheme:{default:{dataScheme:[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Dj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Dj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Kj,line:Uj,area:Fj,bar:zj,bar3d:Hj,pie:Yj,pie3d:$j,map:Gj,radar:Xj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:jj,funnel3d:Nj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:qj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:Wj,treemap:Zj,sunburst:iX,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Dj},minLabel:{position:sX.end},maxLabel:{position:sX.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Dj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Dj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...oX,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...oX,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...oX},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...oX}},axis:rX,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10}},axisY:{label:{space:20},title:{space:20,autoRotate:!0}},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Dj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Dj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!1,background:{size:5,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:8,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{lineWidth:1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{lineWidth:1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:aX,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Lj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Dj,lineHeight:Lj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Dj,fontFamily:Ij}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Dj,fontFamily:Ij}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}}}},hX=new Map([[lX.name,lX]]),cX=lX.name;class dX{static instances=new Map;static registerInstance(t){dX.instances.set(t.id,t)}static unregisterInstance(t){dX.instances.delete(t.id)}static getInstance(t){return dX.instances.get(t)}static instanceExist(t){return dX.instances.has(t)}static forEach(t,e=[],i){const n=Cn(e);return dX.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class uX{static themes=new Map;static _currentThemeName=cX;static registerTheme(t,e){t&&uX.themes.set(t,xn({},uX.getDefaultTheme(),e))}static getTheme(t){return uX.themes.get(t)||uX.getDefaultTheme()}static removeTheme(t){return uX.themes.delete(t)}static themeExist(t){return uX.themes.has(t)}static getDefaultTheme(){return uX.themes.get(cX)}static setCurrentTheme(t){uX.themeExist(t)&&(uX._currentThemeName=t,dX.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return uX.getTheme(uX._currentThemeName)}static getCurrentThemeName(){return uX._currentThemeName}}uX.registerTheme(cX,hX.get(cX)),hX.forEach(((t,e)=>{e!==cX&&uX.registerTheme(e,t)}));const pX=(t,e,i)=>new wr({defaultFontParams:{fontFamily:Bj,fontSize:14},getTextBounds:i?void 0:xB,specialCharSet:"-/: .,@%'\"~"+wr.ALPHABET_CHAR_SET+wr.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),gX=_B({});function fX(t,e){for(let i=0;it.key===e))}function yX(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const _X=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;s{un(t.state[e])||(t.state[e]=SX(t.state[e]))})),t}function xX(t){return un(t)?null:(Object.keys(t).forEach((e=>{un(t[e])||(t[e]=SX(t[e]))})),t)}function SX(t){return un(t)||t.angle&&(t.angle=Es(t.angle)),t}var wX;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(wX||(wX={}));class AX{static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Za,fields:to,filter:s,fold:Qa};static dataParser={csv:po,dsv:uo,tsv:go};static _layout={};static registerChart(t,e){AX._charts[t]=e}static registerSeries(t,e){AX._series[t]=e}static registerComponent(t,e){AX._components[t]=e}static registerMark(t,e){AX._marks[t]=e}static registerRegion(t,e){AX._regions[t]=e}static registerTransform(t,e){AX.transforms[t]=e}static registerLayout(t,e){AX._layout[t]=e}static createChart(t,e,i){if(!AX._charts[t])return null;return new(0,AX._charts[t])(e,i)}static createRegion(t,e,i){if(!AX._regions[t])return null;return new(0,AX._regions[t])(e,i)}static createSeries(t,e,i){if(!AX._series[t])return null;return new(0,AX._series[t])(e,i)}static createMark(t,e,i){if(!AX._marks[t])return null;const n=new(0,AX._marks[t])(e,i);return n.type===wX.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(AX._components)}static getComponentInKey(t){return AX._components[t]}static getLayout(t){return AX._layout[t]}static getSeries(t){return AX._series[t]}}const kX=(t,e,i)=>{const n=t.getRegionsInIds(Cn(e.layoutBindRegionID));return n?.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},MX=(t,e)=>t===e||!Xi(t)&&!Xi(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),CX=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},TX="monotone",EX="linearClosed";var RX;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(RX||(RX={}));var PX;function BX(t){return"bottom"===t||"top"===t}function IX(t){return"left"===t||"right"===t}function DX(t){return"z"===t}function LX(t,e){return Xh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(PX||(PX={}));const OX=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&kX(t,n,i)));return n.length?n:null},FX=t=>t.fieldX[0],zX=t=>t.fieldY[0],HX=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=jX(t,n,"x",FX);e&&o.push(e)})),a&&a.forEach((t=>{const e=jX(t,s,"y",zX);e&&o.push(e)})),o.length?o:null},jX=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return NX(t,a,n)},NX=(t,e,i)=>{const n=t.getScale();if(!n||!Wl(n.type))return null;if(Xi(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=CX(e,t,"cartesian",i??(BX(t.orient)?FX:zX));return{index:s,value:e,axis:t,data:r}},VX=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&kX(t,n,i)));return n.length?n:null},WX=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&Wl(e.type)){const h=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=Ol({x:1,y:0},c);d=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(d,r);const u=Fl(c),p=a[0]?.getScale(),g=p?.range();if((d-r?.[0])*(d-r?.[1])>0||(u-g?.[0])*(u-g?.[1])>0)return;const f=Math.abs(r[0]-r[1])/i.length/2,m=e.invert(d+f);if(Xi(m))return;let y=e.domain().findIndex((t=>t?.toString()===m.toString()));y<0&&(y=void 0);const _=CX(m,t,"polar",l);o.push({index:y,value:m,axis:t,data:_})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&Wl(e.type)){const a=t.getCenter(),h={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let c=Ol({x:1,y:0},h);c<-Math.PI/2&&(c=2*Math.PI+c);const d=Fl(h),u=r[0]?.getScale(),p=u?.range();if((c-p?.[0])*(c-p?.[1])>0||(d-i?.[0])*(d-i?.[1])>0)return;const g=e.invert(d);if(Xi(g))return;let f=e.domain().findIndex((t=>t?.toString()===g.toString()));f<0&&(f=void 0);const m=CX(g,t,"polar",l);o.push({index:f,value:g,axis:t,data:m})}})),o.length?o:null};class UX{_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=HX(this._chart,{x:t,y:e})??[],n=WX(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!Wl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=NX(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var GX;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(GX||(GX={}));const YX={[GX.dimensionHover]:class extends UX{_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:O$.chart},callback:this.onMouseMove}),qo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:O$.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),qo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!MX(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[GX.dimensionClick]:class extends UX{constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:O$.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let $X=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(YX[t]){const e=new YX[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(YX[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class XX{_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(F$.vchart,[]),this._levelNodes.set(F$.chart,[]),this._levelNodes.set(F$.model,[]),this._levelNodes.set(F$.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const KX={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class qX{globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||O$.chart),n=this.getEventListeners(e.filter?.source||O$.chart);i.get(t)||i.set(t,new XX);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||O$.chart),s=this.getEventListeners(e?.filter?.source||O$.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||O$.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||O$.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(F$.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(F$.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(F$.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(F$.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(O$.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(O$.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if($i(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&pn(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return KX[n]&&(n=KX[n]),(!t.type||n===t.type)&&(!Ki(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=Ki(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=Ki(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&Ki(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();Ki(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:pn(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:Ki(t.id)?F$.model:F$.vchart:F$.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ts(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=Qn(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=O$.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==F$.model&&i!==F$.mark||(n=e.type),e?.source&&(s=e.source),Ki(e?.id)&&(o=e?.id,i=F$.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case O$.chart:return this._viewBubbles;case O$.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case O$.chart:return this._viewListeners;case O$.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return D$.includes(t)||Object.values(uV).includes(t)||Object.values(L$).includes(t)}}function ZX(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function JX(t,e,i){t.getParser(e)||t.registerParser(e,i)}const QX=new Map;let tK;function eK(t,e,i={type:"geojson",centroid:!0}){QX.has(t)&&Uo(`map type of '${t}' already exists, will be overwritten.`),tK||(tK=new zo,JX(tK,"geojson",Bo),JX(tK,"topojson",Do),ZX(tK,"simplify",Za));const n=new jo(tK),s=xn({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),QX.set(t,n)}function iK(t,e=!1){let i=e;return t.latestData instanceof jo&&(i=!1),i?yn(t.latestData):t.latestData.slice()}const nK=(t,e)=>0===t.length?[]:1===t.length?iK(t[0],e?.deep):t.map((t=>iK(t,e?.deep)));function sK(t,e,i){ZX(e=e instanceof zo?e:t.dataSet,"copyDataView",nK);const n=new jo(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function rK(t,e,i=[]){if(t instanceof jo)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new jo(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!tn(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Go("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const aK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)}}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!tn(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&yj.getCancelAnimationFrame()(this._rafId),this._rafId=yj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===O$.chart){const n=function(n,s){const r=s?.mark?.context??{},a=Ki(r.modelId)?r.modelId:null,o=Ki(r.markId)?r.markId:null,l=Ki(r.modelUserId)?r.modelUserId:null,h=Ki(r.markUserId)?r.markUserId:null,c={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,c)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===O$.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===O$.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===O$.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(Xi(e))return;const i=e.id(),n=t.grammarType;Xi(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(Xi(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];Ki(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return Ki(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return Ko(this._option.mode)?globalThis:this.getStage()?.window}}async function gK(t){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){console.error("getCanvasDataURL",t)}return t.toDataURL()}class fK{id=Qo();static useChart(t){t.forEach((t=>AX.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>AX.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>AX.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>AX.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>AX.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){AX.registerTransform(t,e)}static registerMap(t,e,i){eK(t,e,i)}static unregisterMap(t){!function(t){QX.has(t)?QX.delete(t):Uo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,QX.get(e);var e}static hideTooltip(t=[]){dX.forEach((t=>t?.hideTooltip?.()),t)}static InstanceManager=dX;static ThemeManager=uX;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=xn(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,...a}=this._option;i&&(this._container=tn(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=uX.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new pK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,...a,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new qX(this,this._compiler),this._event=new $X(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!Ko(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(L$.initialized,{}),dX.registerInstance(this)):Go("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=ec(tn(t)?JSON.parse(t):t))}_initData(){if(Xi(this._dataSet))return void Uo("dataSet is not initialized");const t=Cn(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Go("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=Qn(((...t)=>{const{width:e,height:i}=Ha(this._container,Qj,tN),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof zo?t:new zo,JX(this._dataSet,"dataview",Lo),JX(this._dataSet,"array",e),ZX(this._dataSet,"stackSplit",aK),ZX(this._dataSet,"copyDataView",nK);for(const t in AX.transforms)ZX(this._dataSet,t,AX.transforms[t]);for(const t in AX.dataParser)JX(this._dataSet,t,AX.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return Ki(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)}))),this._event.emit(L$.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(oK.update,!0)}))),this._event.emit(L$.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),QX.clear(),tK=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,dX.unregisterInstance(this)}async updateData(t,e,i){if(Xi(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=Cn(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):en(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new jo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(Xi(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new jo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(tn(t)&&(t=JSON.parse(t)),e&&(t=xn({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=ec(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}_updateCurrentTheme(){tn(this._spec?.theme)?(this._currentTheme=xn({},uX.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=xn({},uX.getTheme(this._currentThemeName),this._spec?.theme??{})}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return uX.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===n.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(Ki(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===n.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===n.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===n.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await gK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!Ko(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(Ki(this._container))return this._container;let t;return t=tn(this._canvas)?document?.getElementById(this._canvas):this._canvas,Ki(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(un(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(Ki(n)?r=this._chart.getSeriesInUserId(n):Ki(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),tc(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||Xi(t)||un(e))return null;if(!en(t)){const{axisId:n,axisIndex:s}=e;let r;if(Ki(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):Ki(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Uo("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return Ki(n)?r=this._chart.getSeriesInUserId(n):Ki(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?tc(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Uo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(hK||(hK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(cK||(cK={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(dK||(dK={}));class mK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){Xi(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,xn({},mK.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return[...this._children]}getMarksInType(t){const e=Cn(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}class yK{event;interaction;_option;_marks=new mK;_markReverse=new mK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){un(t.stateStyle[hK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),un(t.stateStyle[hK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(GX.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=en(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(hK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(hK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(hK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(hK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(hK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(hK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class _K{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class vK extends _K{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=Q$.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Jh(Qh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=Xi(t.minHeight)?null:Zh(t.minHeight,e.height,e),this._maxHeight=Xi(t.maxHeight)?null:Zh(t.maxHeight,e.height,e),this._minWidth=Xi(t.minWidth)?null:Zh(t.minWidth,e.width,e),this._maxWidth=Xi(t.maxWidth)?null:Zh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Zh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Zh(t.height,e.height,e)},{height:9}),Xi(t.offsetX)||(this.layoutOffsetX=Zh(t.offsetX,e.width,e)),Xi(t.offsetY)||(this.layoutOffsetY=Zh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{Xi(this._spec[i])||(e[i]=Zh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};Xi(n)||(r.width-=n),Xi(s)||(r.width-=s),Xi(e)||(r.height-=e),Xi(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(Xi(n)?Xi(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,Xi(e)?Xi(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){an(t)&&(this._layoutStartPoint.x=t),an(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){an(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),an(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}_setRectInSpec(t){const e={...t};return this._layoutRectLevelMap.width<9?(Xi(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),Xi(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(Xi(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),Xi(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class bK extends _K{grammarType;id=Qo();_product;getProduct(){if(Ki(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return Ki(e)&&Ki(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){Ki(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(Ki(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(Ki);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class xK extends bK{grammarType=lK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}Ki(this._value)&&this._product.value(this._value),Ki(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class SK extends _K{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new xK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class wK extends SK{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(xn(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class AK extends wK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class kK extends vK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new mK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=Qo(),this._originalSpec=t,this._spec=ic(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new $X(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new AK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&An(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=ic(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(Xi(t)||Xi(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=xn({},e?.[Cn(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),en(t))return t.map((t=>qi(t)&&!$i(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];qi(n)&&!$i(n)&&(jh(n)?e[i]=Hh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){Ki(t)&&Ki(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!Ki(t)||!Ki(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${Jj}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=AX.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const MK={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",rectRound:"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"},CK={symbol:function(t,e){return"shape"===t?MK[e]??e:e}};const TK={};Object.values(hK).forEach((t=>{TK[t]=!0}));const EK={[hK.STATE_HOVER]:hK.STATE_HOVER_REVERSE,[hK.STATE_SELECTED]:hK.STATE_SELECTED_REVERSE,[hK.STATE_DIMENSION_HOVER]:hK.STATE_DIMENSION_HOVER_REVERSE};function RK(t){return EK[t]}class PK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!un(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=RK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=RK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=RK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=RK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class BK extends wK{id=Qo();stateKeyToSignalName=t=>`${Jj}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===oK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===oK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===oK.enter?oK.appear:oK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===oK.enter?oK.appear:oK.none}}}}class IK extends kK{static type="region";modelType="region";type=IK.type;_series=[];layoutType="region";layoutZIndex=J$.Region;animate;interaction=new PK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new BK({getCompiler:e.getCompiler})),Ki(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:wX.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",W$.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",W$.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:wX.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:wX.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",W$.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(J$.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",W$.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",W$.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",W$.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||Cn(t.userId).includes(e.userId))&&(!Ki(t.specIndex)||!e.getSpecIndex||Cn(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(L$.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new yK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in cK)un(t.stateStyle[cK[e]])||this.interaction.registerMark(cK[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class DK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient&&(this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const LK=[wX.line,wX.area,"trail"];function OK(t){return LK.includes(t)}class FK extends wK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];Ki(n.domain)&&(s.domain=n.domain),Ki(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=Yi(OK)?n:!t.mark||OK(t.mark.markType);let s=!1,r=!1;if(Ki(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!TK[t])).map((t=>[t,10])),n=!t.mark||OK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(en(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Jj)));n=t.datums.some((t=>i&&en(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(qi(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Jj)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(Nl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class zK extends bK{grammarType=lK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();Xi(t)||(Xi(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class HK extends zK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return Ki(t)?t:`${Jj}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;Xi(t)||Ki(this.getProduct())||this._initProduct(t)}}class jK extends bK{grammarType=lK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=J$.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){Ki(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){Xi(this._data)&&this.initMarkData({...this._option,mark:this}),Ki(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new FK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new $X(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new HK(t)}stateKeyToSignalName(t){return`${Jj}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(Ki(e)&&this.removeProduct());if(Ki(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),Xi(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(Xi(this._data))return;this._data.compile();const t=this._data.getProduct();Ki(this._product)&&Ki(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[hK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!$i(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(uV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===oK.appear&&this.runAnimationByState(oK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),CK[a]?CK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class NK extends jK{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(Ki(t.id)&&(this._userId=t.id),Yi(t.interactive)&&(this._interactive=t.interactive),Ki(t.zIndex)&&this.setZIndex(t.zIndex),Yi(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(rn(t))return kl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(kl)),t}return"function"==typeof t?(e,i,n,s)=>kl(t(e,i,n,s)):t}isUserLevel(t){return[W$.User_Mark,W$.User_Series,W$.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(Xi(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];Xi(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;Ki(r)&&r<=n&&xn(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Vl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return tn(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=Uh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;return s=this.stateStyle[i]?.[t]?this._computeStateAttribute(this.stateStyle[i][t],t,e,i,n):this._computeStateAttribute(this.stateStyle.normal[t],t,e,i,n),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,s):s}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):tX.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):Vl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",W$.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=$i(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,W$.User_Mark,e)}else this.setStyle(i,t,W$.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let l=s,h=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(l=t),h||(h=e)}const c=Fh(Oh(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),d={},u={...eX[n],...a};return Object.keys(u).forEach((t=>{const n=u[t];"stops"===t?d.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??l?.scale(e[h]);return $i(s)&&(a=s(e,this._attributeContext,i,o)),Ki(n)&&(a=Wo.SetOpacity(a,n)),{offset:$i(r)?r(e,this._attributeContext,i,o):r,color:a||c[0]}})):$i(n)?d[t]=n(e,this._attributeContext,i,o):d[t]=n})),d.gradient=n,d}_computeThresholdAttr(t){return(new Ph).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class VK extends NK{static type=wX.group;type=VK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Uo("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Uo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class WK extends NK{static type=wX.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(nV.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}fK.useMark([WK,VK]),AX.registerRegion("region",IK),AX.registerLayout("base",DK);var UK,GK,YK;!function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(UK||(UK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(GK||(GK={}));class $K{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Uh("colorOrdinal"):Uh(t.type)),e?(en(t.range)&&e.range(t.range),en(t.domain)&&(el(t.domain)||e.domain(t.domain)),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(An(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!An(n.range,s.range())&&(s.range(n.range),e.reRender=!0),el(n.domain)?e.reRender=!0:An(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{el(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{fX(e,[{key:t,operations:Nl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&fX(e,[{key:i.field,operations:Nl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!el(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=Nl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{Nl(e.type)?(Xi(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),Xi(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;Nl(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!Xi(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(Nl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(Nl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));Nl(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(Xi(t.field)||!Xi(t.changeDomain)&&"none"!==t.changeDomain&&!Xi(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class XK{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(L$.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][G$]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[G$],s>=0?(t[U$]=e,e+=t[G$],t[G$]=e):(t[U$]=i,i+=t[G$],t[G$]=i)})),t.values.forEach((t=>{s=t[G$];const r=s>=0?e:i;n=s>=0?1:-1,t[Y$]=Math.min(1,t[U$]/r)*n,t[$$]=Math.min(1,t[G$]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[G$]=function(t){if(an(t))return t;const e=+t;return an(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class KK extends _K{type="chart";id=Qo();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:Qj,height:tN};getLayoutRect(){return this._layoutRect}_viewRect={width:Qj,height:tN};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:Qj,y2:tN};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=Qh(t.padding??this._theme?.padding),this._event=new $X(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new XK(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),fn(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=AX.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=rK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),Ki(t.regionId)?i=this.getRegionsInUserId(t.regionId):Ki(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=AX.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&Cn(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=AX.getComponents();let i,s;const r=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(AX.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(L$.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(L$.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Cn(t).some((t=>Ki(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof kK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof NK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof NK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(Ki(t)&&Ki(e))this._canvasRect={width:t,height:e};else{let i=Qj,n=tN;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=Ha(this._option.container,Qj,tN);i=t,n=e}else if(r&&Ko(this._option.mode)){let t;t=tn(r)?document?.getElementById(r):r;const{width:e,height:s}=Ha(t,Qj,tN);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;en(t)?e.range=t.map((t=>Hh(t,this._theme?.colorScheme))):(e.type=t.type,t.domain&&(e.domain=t.domain),e.range=t.range)}return e.range?.length||(e.range=Oh(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new $K(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Oh(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&Cn(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};en(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Jh(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(un(t[n]))continue;const s=t[n];let r={stateValue:n};r=$i(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(hK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(hK.STATE_HOVER,!0,t,e,i)}initEvent(){[L$.dataZoomChange,L$.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(uV.AFTER_MARK_RENDER_END,e)};this._event.on(uV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?Cn(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||$i(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===GX.dimensionHover||s===GX.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===n.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===n.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class qK extends KK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function ZK(t){t.crosshair=Cn(t.crosshair||{}).map((e=>xn({[t.direction===$h.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(YK||(YK={}));const JK=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:h}=e,c=[],{dimensionValues:d,dimensionData:u}=h().latestData,p=Array.from(d[i]);let g={start:0,end:0,lastIndex:null};return p.forEach(((t,e)=>{const i={start:g.end,end:g.end,lastIndex:g.lastIndex,lastEnd:g.end,index:t,isTotal:!1};u[t].forEach((t=>{let h=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(h=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,g);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!Xi(t[a.collectCountField])){const i=c.length-+t[a.collectCountField],n=c.length-1;i<0?console.warn("total.collectCountField error"):e=c[i].start,n<0?console.warn("total.collectCountField error"):o=c[n].end}else a.startField&&!Xi(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!Xi(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===p.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,h=!0);h||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=h,(Xi(o)||o===z$)&&(t[z$]=h?l.total:+t[n]>=0?l.increase:l.decrease)})),g={...i,lastIndex:t},c.push(i)})),c},QK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},tq=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:eq(t.map((t=>t.latestData)).flat(),e.fields,i)}};function eq(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>eq(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class iq{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new jo(e instanceof zo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),ZX(e,"dimensionTree",tq),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const nq=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class rq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new mK;_markReverse=new mK;constructor(t,e){this._spec=t,this._option=e,this.event=new $X(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(hK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(hK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(Cn(i).forEach((e=>{t.on(e,{level:F$.chart},this.onHover)})),n&&"none"!==n&&Cn(n).forEach((e=>{t.on(e,{level:F$.vchart,source:O$.chart},this.onUnHover)}))),s&&(Cn(r).forEach((e=>{t.on(e,{level:F$.mark},this.onSelect)})),a&&"none"!==a&&Cn(a).forEach((e=>{t.on(e,{level:F$.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=sq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;Yi(i)?this._hover.enable=i:qi(i)&&(this._hover.enable=!0,this._hover=xn(this._hover,i));const n=this._spec.select;Yi(n)?this._select.enable=n:qi(n)&&(this._select.enable=!0,this._select=xn(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,hK.STATE_HOVER)||this.interaction.getEventElement(hK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,hK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(hK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(hK.STATE_HOVER,t.item),this.interaction.reverseEventElement(hK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(hK.STATE_HOVER);this.interaction.clearEventElement(hK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(hK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,hK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(hK.STATE_SELECTED);this.interaction.clearEventElement(hK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(hK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(hK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(hK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(hK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(hK.STATE_SELECTED);const e=this.interaction.getEventElementData(hK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,hK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class aq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const oq=(t,e)=>Ki(e)?t.map((t=>e[t])):void 0,lq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),hq=t=>!Xi(t)&&(en(t)?t.length>0&&t.every(Ki):Object.keys(t).length>0);function cq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(Ki(s.regionId)?[s.regionId]:void 0,Ki(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=Ki(s)?t[s]:void 0,a=Ki(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=oq(i,t);let h=oq(n,t);const c=hq(h),d=!c&&Ki(s)&&Xi(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,u=i.map(((t,e)=>[t,e])).filter((([,t])=>Xi(l?.[t])));let p=[l??[]];u.length>0&&u.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];p.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),p=s})),p.forEach((l=>{if(d){const r=t.getViewData()?.latestData.filter(lq(i,l));a.forEach((a=>{const d=r.find((t=>t[s]===a));if(h=oq(n,d),!hq(h))return;const u=t.dataToPosition(d);Xi(u)||isNaN(u.x)||isNaN(u.y)||o.push({pos:u,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===GK.pie){const t=e,a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToCentralPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}else{const t=e;if(d){const d=t.getViewData()?.latestData.filter(lq(i,l)),u=d.find((t=>t[s]===r));a.forEach((r=>{if(h=oq(n,u),!hq(h))return;const a=t.dataToPosition(u);Xi(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(lq(i,l));if(!c&&(h=oq(n,a),!hq(h)))return;const d=t.dataToPosition(a);if(Xi(d)||isNaN(d.x)||isNaN(d.y))return;o.push({pos:d,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:h,hasMeasureData:c,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),h=r.getLayoutStartPoint(),c=r.getLayoutRect(),d=n.globalInstance.getContainer(),u={x:0,y:0,...d?ja(d):{}},p=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>lq(e,i)(t)&&lq(n,s)(t)&&(Xi(r)||lq([r],[a])(t))));return o},g=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),c.width),y:Math.min(Math.max(t.y,0),c.height)}))(t),i=s.x??h.x+e.x,n=s.y??h.y+e.y;return{canvasX:i,canvasY:n,clientX:u.x+i,clientY:u.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>p(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:O$.chart,event:g({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return fK.globalConfig.uniqueTooltip&&fK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...p(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:O$.chart,event:g(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return fK.globalConfig.uniqueTooltip&&fK.hideTooltip(a.id),l}return"none"}const dq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return Ki(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function uq(t){return Xi(t.mark)&&Xi(t.model)&&Xi(t.datum)}class pq extends aq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];Ki(i)&&(e[t]={...i,title:Ki(i.title)?$i(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:Ki(i.content)?$i(i.content)?i.content:Cn(i.content).map((t=>$i(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=dq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:Ki(e)?Cn(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of Cn(e)){const e=this.series.getSeriesStyle(t)?.(i);if(Ki(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return Ki(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const gq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},fq={min:t=>t===gq.min()?0:t,max:t=>t===gq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===gq.min()?0:t,"array-max":t=>t===gq.max()?0:t};const mq={min:function(t,e){return tl(e)?Math.min(t,e):t},max:function(t,e){return tl(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>tl(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>tl(t)));return 0===i.length?t:Math.max(t,...i)}},yq=(t,e)=>{const i={};let n=e.fields;if($i(n)&&(n=n()),!n?.length||!t?.length)return i;n=fX([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!Xi(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=gq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=mq[n](i[t.key][n],s)})),i[t.key][n]=fq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},_q=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>tl(t[s])));else if("zero"===n)return t.forEach((t=>{tl(t[s])||(t[s]=0)})),t;return t};class vq extends zK{_compileProduct(){const t=this._data?.latestData;Xi(t)||Ki(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const bq=`${Jj}_HIERARCHY_DEPTH`,xq=`${Jj}_HIERARCHY_ROOT`,Sq=`${Jj}_HIERARCHY_ROOT_INDEX`,wq=()=>({keyMap:new Map});function Aq(t,e,i){t&&(this._seriesField||(t[N$]=this.getSeriesKeys()[0]),t[H$]=e,t[j$]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function kq(t,e,i,n=0,s,r){void 0===r&&(r=e),Aq.bind(this)(t,e,i),t[bq]=n,t[xq]=s||t[this.getCategoryField()],t[Sq]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>kq.bind(this)(e,n,i,t[bq]+1,t[xq],r)))}class Mq extends kK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[UK.label]:{name:UK.label,type:wX.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){Ki(t)&&(this._seriesField=t,this.getMarksInType([wX.line,wX.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(L$.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&Ki(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(L$.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(Xi(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),Yi(this._spec.stack)&&(this._stack=this._spec.stack),Yi(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),Yi(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),Ki(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=sK(this._rawData,this._dataSet,{name:`${Jj}_series_${this.id}_viewDataFilter`});const t=sK(this._viewDataFilter,this._dataSet,{name:`${Jj}_series_${this.id}_viewData`});this._data=new vq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(ZX(this._option.dataSet,"invalidTravel",_q),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new iq(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${Jj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${Jj}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){ZX(this._dataSet,"dimensionStatistics",yq);const n=new jo(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=fX(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&fX(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${Jj}_series_${this.id}_viewStackData`;this._viewStackData=new jo(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(Xi(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(tn(t))return e[t];if(en(t)&&t.every((t=>tn(t))))return t.map((t=>e[t])).join("-");if($i(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(ZX(this._rawData.dataSet,"addVChartProperty",nq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(L$.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(L$.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(L$.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(L$.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(L$.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||Xi(e)?[]:tn(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:wX.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Jj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Jj}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||Xi(t.dataId)&&Xi(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new rq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??N$;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:V$,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,V$)}))}afterInitMark(){this.event.emit(L$.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",W$.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new pq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??N$,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Oh(this._option.getTheme().colorScheme,this.type);return(new Vh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??N$}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=xn({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:o,dataProductId:l,parent:h,isSeriesMark:c,dataStatistics:d,depend:u,label:p,progressive:g,support3d:f=this._spec.support3d||!!this._spec.zField,morph:m=!1}=e,y=super._createMark(t,{key:i??this._getDataIdKey(),support3d:f,dataStatistics:d??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(Ki(y)){this._marks.addMark(y),c&&(this._seriesMark=y),Xi(h)?this._rootMark?.addMark(y):!1!==h&&h.addMark(y),Xi(o)?(y.setDataView(this.getViewData(),this.getViewDataProductId()),y.setSkipBeforeLayouted(!0)):!1!==o&&y.setDataView(o,l),Yi(s)&&y.setSkipBeforeLayouted(s),Ki(u)&&y.setDepend(...Cn(u)),Ki(p)&&y.setLabelSpec(p);const t=this.getSpec()||{};y.setMorph(m),y.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),y.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),Xi(g)||y.setProgressiveConfig(g),Xi(n)||y.setGroupKey(n),this.initMarkStyleWithSpec(y,xn({},r,a||t[y.name]))}return y}_getDataIdKey(){return super._getDataIdKey()??j$}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==G$&&t!==$$&&t!==U$&&t!==Y$||(t=this.getStackValueField()),yX(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=AX.getSeries(this.type);return Object.values(t.mark??{})}return t}}class Cq extends Mq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Cn(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Cn(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Cn(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=$h.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&this._fieldX.forEach((e=>{const i={key:e,operations:[]};Nl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&this._fieldY.forEach((e=>{const i={key:e,operations:[]};Nl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};Nl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===$h.vertical?Cn(this._spec.yField)[0]:Cn(this._spec.xField)[0]}setValueFieldToStack(){this.direction===$h.vertical?(this.setFieldY(G$),this.setFieldY2(U$)):(this.setFieldX(G$),this.setFieldX2(U$))}setValueFieldToPercent(){this.direction===$h.vertical?(this.setFieldY($$),this.setFieldY2(Y$)):(this.setFieldX($$),this.setFieldX2(Y$))}setValueFieldToStackOffsetSilhouette(){this.direction===$h.vertical?(this.setFieldY(K$),this.setFieldY2(X$)):(this.setFieldX(K$),this.setFieldX2(X$))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Vo(t.xField,i)&&Vo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),Ki(this._spec.direction)&&(this._direction=this._spec.direction),this._direction===$h.vertical?(this.setFieldY2("y1"),this.setFieldX2(this._spec?.x2Field)):(this.setFieldX2("x1"),this.setFieldY2(this._spec?.y2Field)),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(Cn(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(Cn(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[0]:Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===$h.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===$h.vertical?Cn(this._spec.yField??this.fieldY):Cn(this._spec.xField??this.fieldX)}}const Tq=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};const Eq={type:"clipIn"},Rq={type:"fadeIn"};function Pq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===$h.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===$h.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Rq;default:return Eq}}function Bq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=i?.[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const Iq=(t,e=!0)=>({type:t.direction===$h.horizontal?"growWidthIn":"growHeightIn",options:Bq(t,e)}),Dq=(t,e=!0)=>({type:t.direction===$h.horizontal?"growWidthOut":"growHeightOut",options:Bq(t,e)}),Lq={type:"fadeIn"},Oq={type:"growCenterIn"};function Fq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Lq;case"scaleIn":return Oq;default:return Iq(t)}}const zq={type:"clipIn"},Hq={type:"fadeIn"};function jq(t,e){switch(e){case"grow":return(t=>({type:t.direction===$h.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===$h.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Hq;default:return zq}}function Nq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Vq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Nq(t,!0,oK.appear)}),Wq={type:"fadeIn"},Uq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Nq(t,!0,oK.enter)}),Gq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Nq(t,!0,oK.exit)}),Yq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:Nq(t,!0,oK.exit)});function $q(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Wq;case"growRadius":return Vq({...t,growField:"radius"});default:return Vq({...t,growField:"angle"})}}const Xq={type:"fadeIn"};function Kq(t,e){return"fadeIn"===e?Xq:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function qq(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const Zq=t=>({type:t.direction===$h.horizontal?"growWidthOut":"growHeightOut",options:qq(t)}),Jq={type:"fadeIn"};function Qq(t,e){return!1===e?{}:"fadeIn"===e?Jq:(t=>({type:t.direction===$h.horizontal?"growWidthIn":"growHeightIn",options:qq(t)}))(t)}const tZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function eZ(t,e,i){return"fadeIn"===e?tZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function iZ(t,e,i){return"fadeIn"===e?tZ(i):((t,e)=>{const i=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const nZ=(t,e)=>({custom:LC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class sZ extends dC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;$i(r)&&$i(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);an(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);an(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class rZ extends IC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new As(d,u,p,g);return f.defined=e.defined,f}}const aZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},oZ={type:"fadeIn"},lZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),hZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),cZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function dZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return oZ;case"growAngle":return aZ({...t,growField:"angle"});default:return aZ({...t,growField:"radius"})}}const uZ={type:"fadeIn"},pZ={type:"growCenterIn"};function gZ(t,e){switch(e){case"fadeIn":return uZ;case"scaleIn":return pZ;default:return Iq(t,!1)}}const fZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},mZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),yZ={type:"fadeIn"},_Z=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vZ(t,e){return"fadeIn"===e?yZ:mZ(t)}const bZ=t=>({custom:FC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),xZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},SZ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},wZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===iV.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},AZ=(t,e,i)=>{if(un(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},kZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=AZ(r,n,s);return SZ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=AZ(r,n,s);return SZ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),MZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},CZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=MZ(r);return SZ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=wZ(i),a=MZ(r);return SZ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),TZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},EZ={type:"fadeIn"};function RZ(t){return!1===t?{}:EZ}const PZ={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},BZ={bar:(t,e)=>({appear:Fq(t,e),enter:Iq(t,!1),exit:Dq(t,!1),disappear:Dq(t)}),bar3d:(t,e)=>({appear:Fq(t,e),enter:Iq(t,!1),exit:Dq(t,!1),disappear:Dq(t)}),line:(t,e)=>({appear:jq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:IC,duration:PZ.update.duration,easing:PZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:Pq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:$q(t,e),enter:Uq(t),exit:Gq(t),disappear:Yq(t)}),pie3d:(t,e)=>({appear:$q(t,e),enter:Uq(t),exit:Gq(t),disappear:Yq(t)}),rose:(t,e)=>({appear:dZ(t,e),enter:lZ(t),exit:hZ(t),disappear:cZ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:eZ(t,e,"in"),enter:eZ(t,e,"in"),exit:eZ(t,e,"out"),disappear:"clipIn"===e?void 0:eZ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:rZ,customParameters:t,duration:PZ.update.duration,easing:PZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:iZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:iZ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:sZ,customParameters:t,duration:PZ.update.duration,easing:PZ.update.easing}]}),radarGroup:(t,e)=>({appear:nZ(t,"in"),disappear:nZ(t,"out")}),circularProgress:(t,e)=>({appear:Kq(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:fZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:Qq(t,e),enter:{type:"grow"},disappear:Zq(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:OC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:OC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:bZ(t)}),rangeColumn:(t,e)=>({appear:vZ(t,e),enter:mZ(t),exit:_Z(t),disappear:_Z(t)}),waterfall:(t,e)=>({appear:gZ(t,e),enter:Iq(t,!1),exit:Dq(t,!1),disappear:Dq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:xZ(0,e),enter:kZ(t),exit:CZ(t),disappear:CZ(t)}),circlePacking:(t,e)=>({appear:TZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:RZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:mG},update:{custom:fG},exit:{custom:zC}})},IZ=["appear","enter","update","exit","disappear","normal"];function DZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=$i(n)?n(t,s,r):an(n)?n:0;let l=$i(i)?i(t,s,r):i;return!1===l?0:(l=!0===l?0:l,a*(o+l))},delete t.oneByOne,t}function FZ(t){return t?.[H$]}function zZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function HZ(t){return!function(t){return Ki(t.timeSlices)}(t)&&Ki(t.channel)}class jZ extends NK{static type=wX.rect;type=jZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class NZ extends NK{static type=wX.text;type=NZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}fK.useMark([jZ,NZ]);class VZ extends Cq{static type=GK.bar;type=GK.bar;_barMarkName=UK.bar;_barMarkType=wX.rect;static mark={...Mq.mark,[UK.bar]:{name:UK.bar,type:wX.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...VZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:zZ(this._spec.animation,this._spec.morph,LZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:xn({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===$h.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Gh(this.dataToPositionX(e),t),x1:e=>Gh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Nl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",W$.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Nl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Gh(this.dataToPositionY(t),e),y1:t=>Gh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",W$.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Gh(this.dataToPositionX(e),t),x1:e=>Gh(this.dataToPositionX1(e),t),y:t=>Gh(this.dataToPositionY(t),e),y1:t=>Gh(this.dataToPositionY1(t),e)},"normal",W$.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(DZ(BZ.bar(t,e),LZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Tq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Tq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Tq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class WZ extends NK{static type=wX.rule;type=WZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}fK.useMark([WZ]);class UZ extends VZ{static type=GK.waterfall;type=GK.waterfall;static mark={...VZ.mark,[UK.leaderLine]:{name:UK.leaderLine,type:wX.rule},[UK.stackLabel]:{name:UK.stackLabel,type:wX.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],Xi(this._seriesField)&&(this._seriesField=z$)}getSeriesKeys(){return this._seriesField===z$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),ZX(this._dataSet,"waterfallFillTotal",QK),ZX(this._dataSet,"waterfall",JK),(Xi(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=sK(this.getViewData(),this._dataSet,{name:`${Jj}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new vq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:U$,endAs:G$,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(DZ(BZ.waterfall(t,e),LZ(UK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec),{dataIndex:i}))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(UZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(UZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n}=this._xAxisHelper;return this._direction===$h.vertical?n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("width",t)*i:Gh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n}=this._yAxisHelper;return this._direction===$h.vertical?Gh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("height",t)*i}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===$h.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!Xi(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",W$.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!Xi(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",W$.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===$h.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const GZ=`${Jj}_BOX_PLOT_OUTLIER_VALUE`;var YZ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(YZ||(YZ={}));const $Z=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];en(e)||(e=[e]),i.push(...e.map((e=>{const i={[GZ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class XZ extends pq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(YZ.OUTLIER),value:this.getContentValue(YZ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(YZ.MAX),value:this.getContentValue(YZ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.Q3),value:this.getContentValue(YZ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.MEDIAN),value:this.getContentValue(YZ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.Q1),value:this.getContentValue(YZ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.MIN),value:this.getContentValue(YZ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(YZ.SERIES_FIELD),value:this.getContentValue(YZ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===YZ.OUTLIER)return this.series.getOutliersField();if(t===YZ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case YZ.MIN:return this.series.getMinField();case YZ.MAX:return this.series.getMaxField();case YZ.MEDIAN:return this.series.getMedianField();case YZ.Q1:return this.series.getQ1Field();case YZ.Q3:return this.series.getQ3Field();case YZ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===YZ.OUTLIER)return e[GZ];if(t===YZ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case YZ.MIN:return e[this.series.getMinField()];case YZ.MAX:return e[this.series.getMaxField()];case YZ.MEDIAN:return e[this.series.getMedianField()];case YZ.Q1:return e[this.series.getQ1Field()];case YZ.Q3:return e[this.series.getQ3Field()];case YZ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>Ki(t[GZ])}class KZ extends NK{static type=wX.boxPlot;type=KZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(ZN("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(rW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),QV("barBoxplotScaleIn",tW(sW)),QV("barBoxplotScaleOut",eW(sW))):(ZN("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(nW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),QV("boxplotScaleIn",tW(iW)),QV("boxplotScaleOut",eW(iW)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class qZ extends NK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:RX.circle,fill:void 0,lineWidth:0}}}class ZZ extends qZ{static type=wX.symbol;type=ZZ.type}fK.useMark([KZ,ZZ]);class JZ extends Cq{static type=GK.boxPlot;type=GK.boxPlot;static mark={...Mq.mark,[UK.boxPlot]:{name:UK.boxPlot,type:wX.boxPlot},[UK.outlier]:{name:UK.outlier,type:wX.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(JZ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(JZ.mark.outlier,{progressive:t,key:H$,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===$h.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,hK.STATE_NORMAL,W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:rn(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},hK.STATE_NORMAL,W$.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===$h.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Gh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Gh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Gh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Gh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Gh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},hK.STATE_NORMAL,W$.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===$h.vertical?{x:this.dataToPositionX.bind(this),y:e=>Gh(t(this.getDatumPositionValues(e,GZ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Gh(t(this.getDatumPositionValues(e,GZ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,hK.STATE_NORMAL,W$.Series)}}initData(){if(super.initData(),!this._data)return;ZX(this._dataSet,"foldOutlierData",$Z),ZX(this._dataSet,"addVChartProperty",nq);const t=new jo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Jj}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===$h.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1),this._outlierDataView=new vq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===$h.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===$h.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===$h.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(BZ.boxPlot()),i=this._initAnimationSpec(LZ(UK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(DZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(DZ(BZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new XZ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class QZ{setSeriesField(t){Ki(t)&&(this._seriesField=t,this.getMarksInType([wX.line,wX.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(tJ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",W$.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:EX},"normal",W$.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===TX?t===$h.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",W$.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",W$.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(tJ.point,{morph:zZ(this._spec.animation,this._spec.morph,LZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:xn({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",W$.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?tl(t[this.getStackValueField()]):"link"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?tl(t[this.getStackValueField()]):"link"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series))}}const tJ={[UK.point]:{name:UK.point,type:wX.symbol},[UK.line]:{name:UK.line,type:wX.line}};class eJ extends NK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(Xi(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(Xi(h)||s.includes(l))return;a&&r.includes(l)&&(Vl(h?.type)||h?.scale||$i(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class iJ extends eJ{static type=wX.line;type=iJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===GK.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}fK.useMark([iJ,ZZ,NZ]);class nJ extends Cq{static type=GK.line;type=GK.line;_invalidType="break";static mark={...Mq.mark,...tJ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(DZ(BZ.line(t,e),LZ(UK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(DZ(BZ.symbol(),LZ(UK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}Mn(nJ,QZ);class sJ extends NK{static type=wX.rect3d;type=sJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}fK.useMark([sJ,NZ]);class rJ extends VZ{static type=GK.bar3d;type=GK.bar3d;static mark={...Mq.mark,[UK.bar3d]:{name:UK.bar3d,type:wX.rect3d}};_barMarkName=UK.bar3d;_barMarkType=wX.rect3d}function aJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===$h.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if(l()===$h.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=s(t),o=r(t);if(e===$h.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===$h.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",W$.Series)}class oJ extends pq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===$h.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class lJ extends VZ{static type=GK.rangeColumn;type=GK.rangeColumn;_barMarkType=wX.rect;_barName=GK.bar;static mark={...VZ.mark,[UK.minLabel]:{name:UK.minLabel,type:wX.text},[UK.maxLabel]:{name:UK.maxLabel,type:wX.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(lJ.mark.bar,{morph:zZ(this._spec.animation,this._spec.morph,LZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===nX.bothEnd?void 0:xn({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===nX.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(lJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(lJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===$h.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});aJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===$h.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});aJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===$h.horizontal?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===$h.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===$h.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Gh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Gh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Nl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",W$.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Nl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Gh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Gh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",W$.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(DZ(BZ.rangeColumn({direction:this.direction},e),LZ(UK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new oJ(this)}}fK.useMark([sJ]);class hJ extends lJ{static type=GK.rangeColumn3d;type=GK.rangeColumn3d;_barMarkType=wX.rect3d;_barName=GK.bar3d}class cJ extends eJ{static type=wX.area;type=cJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}fK.useMark([iJ,cJ,NZ,ZZ]);class dJ extends Cq{static type=GK.area;type=GK.area;static mark={...Mq.mark,...tJ,[UK.area]:{name:UK.area,type:wX.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(dJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===TX?this._direction===$h.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===$h.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Gh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",W$.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Gh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",W$.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(i,{curveType:e},"normal",W$.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(DZ(BZ.line(t,e),LZ(UK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(DZ(BZ.area(t,e),LZ(UK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(DZ(BZ.symbol(),LZ(UK.point,this._spec)))}}Mn(dJ,QZ);class uJ extends pq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===$h.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class pJ extends dJ{static type=GK.rangeArea;type=GK.rangeArea;static mark={...dJ.mark};initMark(){this._areaMark=this._createMark(pJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===TX?this._direction===$h.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===$h.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this)},"normal",W$.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",W$.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])},"normal",W$.Series),this.setMarkStyle(i,{curveType:e},"normal",W$.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new uJ(this)}}me();const gJ={},fJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function mJ(t,e){t&&tn(t)||hl("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(gJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=me().projection(n),n.copy=n.copy||function(){const t=i();return fJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),gJ[i]||null}const yJ={albers:De,albersusa:function(){var t,e,i,n,s,r,a=De(),l=Ie().rotate([154,0]).center([-2,58.5]).parallels([55,65]),h=Ie().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){r=[t,e]}};function d(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(n.point(e,a),r)||(s.point(e,a),r)}function u(){return t=e=null,d}return d.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?l:s>=.166&&s<.234&&n>=-.214&&n<-.115?h:a).invert(t)},d.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),l.stream(i),h.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(yJ).forEach((t=>{mJ(t,yJ[t])}));const _J="Feature",vJ="FeatureCollection";function bJ(t){const e=Cn(t);return 1===e.length?e[0]:{type:vJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===vJ?t.features:Cn(t).filter((t=>!Xi(t))).map((t=>t.type===_J?t:{type:_J,geometry:t}))}(e))),[])}}const xJ=fJ.concat(["pointRadius","fit","extent","size"]);function SJ(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{xJ.includes(n)&&(i=i.concat(zN(t[n],e)))})),i):i}const wJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(Xi(i))for(let i=0;i(l(t),t)))};class AJ extends Mq{type=GK.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(Xi(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(Xi(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return Xi(r)||isNaN(r.x)||isNaN(r.y)?null:r}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Jj}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const kJ=(t,e)=>(t.features&&t.features.forEach((t=>{e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class MJ extends pq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class CJ extends NK{static type=wX.path;type=CJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var TJ,EJ,RJ;fK.useMark([CJ,NZ]),TJ="projection",EJ=class extends RW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return Xi(this.spec.pointRadius)||this.detach(zN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(zN(t,this.view)),this.commit(),this}size(t){return Xi(this.spec.size)||this.detach(zN(this.spec.size,this.view)),this.spec.size=t,this.attach(zN(t,this.view)),this.commit(),this}extent(t){return Xi(this.spec.extent)||this.detach(zN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(zN(t,this.view)),this.commit(),this}fit(t){return Xi(this.spec.fit)||this.detach(zN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(zN(t,this.view)),this.commit(),this}configure(t){return this.detach(SJ(this.spec,this.view)),Xi(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(SJ(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=mJ((t||"mercator").toLowerCase());return e||hl("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),fJ.forEach((t=>{var i,n,s;Xi(this.spec[t])||(i=this.projection,n=t,s=jN(this.spec[t],e,mJ),$i(i[n])&&i[n](s))})),Xi(this.spec.pointRadius)||this.projection.path.pointRadius(jN(this.spec.pointRadius,e,mJ)),!(Xi(this.spec.fit)||Xi(this.spec.extent)&&Xi(this.spec.size))){const t=bJ(jN(this.spec.fit,e,mJ));this.spec.extent?this.projection.fitExtent(jN(this.spec.extent,e,mJ),t):this.spec.size&&this.projection.fitSize(jN(this.spec.size,e,mJ),t)}return this.projection}output(){return this.projection}},RJ="projections",c$[TJ]={grammarClass:EJ,specKey:null!=RJ?RJ:TJ};class PJ extends AJ{static type=GK.map;type=GK.map;static mark={...Mq.mark,[UK.area]:{name:UK.area,type:wX.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),!this.map)throw new Error(`map type '${this.map}' is not specified !`);if(!QX.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),ZX(this._dataSet,"copyDataView",nK),ZX(this._dataSet,"map",kJ),ZX(this._dataSet,"lookup",wJ);const t=QX.get(this.map);if(!t)throw Error("no valid map data found!");const e=new jo(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??N$,j$],as:[this.nameField,this.valueField,this._seriesField??N$,j$]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new vq(this._option,e)}initMark(){this._pathMark=this._createMark(PJ.mark.area,{morph:zZ(this._spec.animation,this._spec.morph,LZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(PJ.mark.label,{skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>Ki(t[this._seriesField??N$])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??N$]):this._theme?.defaultFillColor,path:this.getPath.bind(this)},"normal",W$.Series),this.setMarkStyle(t,{smoothScale:!0},"normal",W$.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(DZ(BZ.path(),LZ(UK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec)))}initTooltip(){this._tooltipHelper=new MJ(this)}getPath(t){const e=this._areaCache.get(t?.properties?.[this._nameProperty]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t?.properties?.[this._nameProperty],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===wX.path?s.forEach((t=>{t.getGraphicItem().scale(e,e,i)})):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===wX.path?n.forEach((t=>{t.getGraphicItem().translate(e[0],e[1])})):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return an(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]??t.properties?.[this.nameField]??""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return t=>t?.properties?.[this._nameProperty]}}class BJ extends Mq{coordinate="polar";_outerRadius=TN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=Ki(t)?Cn(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=Ki(t)?Cn(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Cn(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(Xi(t)||Xi(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Cn(t)),n=this.radiusAxisHelper.dataToPosition(Cn(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};Nl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};Nl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),Ki(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),Ki(this._spec.radius)&&(this._outerRadius=this._spec.radius),Ki(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Vo(t.angleField,i)&&Vo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const IJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=Al(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},DJ=(t,e)=>{const i=t[0].latestData;return new OJ(e.series,i).updateLabels()};class LJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class OJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=pX(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[sN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:h}=n;if("inside"!==t?.position){const t=Tl(e.x,e.y,this._series.computeDatumRadius(s,hK.STATE_HOVER),n.middleAngle),i=Tl(e.x,e.y,this._series.computeDatumRadius(s,hK.STATE_SELECTED),n.middleAngle),a=Tl(e.x,e.y,this._series.computeDatumRadius(s,hK.STATE_NORMAL),n.middleAngle);s[pN]=a.x,s[gN]=a.y,s[dN]=t.x,s[uN]=t.y,s[vN]=i.x,s[bN]=i.y,s[fN]=l.x,s[mN]=l.y,s[yN]=h.x,s[_N]=h.y,s[aN]=r.y-o.height/2}else s[aN]=r.y;return s[iN]=this._computeAlign(n),s[eN]=Math.max(a,0),s[sN]=n.labelVisible&&!Xi(n.labelText),s[rN]=r.x,s[nN]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=Tl(e.x,e.y,f,t.middleAngle),t.labelLimit=p,Gn(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=El(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=El(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(Yn(t.pointB.x,n+r)||Gn(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?wl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?Xi(i)||"auto"===i?"edge"===n?El(t.quadrant)?"left":"right":El(t.quadrant)?"right":"left":i:Xi(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=Xi(n)||Xi(t[n])||Xi(t[s]);return $i(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class FJ extends NK{type=zJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+Cl({angle:e[xN],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class zJ extends FJ{static type=wX.arc;type=zJ.type}fK.useMark([CJ,NZ,zJ]);class HJ extends BJ{_pieMarkName=UK.pie;_pieMarkType=wX.arc;static mark={...Mq.mark,[UK.pie]:{name:UK.pie,type:wX.arc},[UK.labelLine]:{name:UK.labelLine,type:wX.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=AN;_endAngle=kN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=Ki(t),r=Ki(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(Ki(this._spec?.startAngle)?kl(this._spec.startAngle):this._startAngle,Ki(this._spec?.endAngle)?kl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=Ki(this._spec?.padAngle)?kl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;ZX(this._dataSet,"pie",IJ),ZX(this._dataSet,"arcLabel",DJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:lN,asEndAngle:hN,asRatio:oN,asMiddleAngle:xN,asRadian:wN,asQuadrant:SN,asK:cN}},!1);const e=new jo(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${Jj}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new vq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...HJ.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:zZ(this._spec.animation,this._spec.morph,LZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark(HJ.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark(HJ.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Yh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Yh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Hl(lN).bind(this),endAngle:Hl(hN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",W$.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,W$.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Hl(sN).bind(this),x:Hl(rN).bind(this),y:Hl(aN).bind(this),text:Hl(nN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Hl(iN).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[xN];return"inside"===this._spec.label?.position?Ml(e):0},limit:Hl(eN).bind(this)},void 0,W$.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Hl(sN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(L$.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return t?.outerRadius&&(e.outerRadius=()=>this.computeLayoutRadius()*t?.outerRadius),t?.innerRadius&&(e.innerRadius=()=>this.computeLayoutRadius()*t?.innerRadius),t?.cornerRadius&&(e.cornerRadius=()=>this.computeLayoutRadius()*t?.cornerRadius),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${Jj}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${Jj}_ARC_LABEL_${e}_AY`])} L${Math.round(t[fN])},${Math.round(t[mN])} L${Math.round(t[yN])},${Math.round(t[_N])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(Xi(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[xN];if(Xi(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=Cl({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[xN];if(Xi(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=Cl({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===oK.appear)return this._startAngle;if(i===oK.disappear)return this._endAngle;const n=[oK.disappear,oK.exit],s=e.mark.elements,r=t,a=r?.[H$];if(void 0===s.find((t=>t.data[0]?.[H$]t.data[0]?.[H$]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[H$]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Cl({angle:e[xN],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Cl({angle:e[xN],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Cl({angle:e[xN],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Cl({angle:e[xN],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class jJ extends HJ{static type=GK.pie;type=GK.pie}class NJ extends FJ{static type=wX.arc3d;type=NJ.type}fK.useMark([CJ,NZ,NJ]);class VJ extends HJ{static type=GK.pie3d;type=GK.pie3d;_pieMarkName=UK.pie3d;_pieMarkType=wX.arc3d;static mark={...Mq.mark,[UK.pie3d]:{name:UK.pie3d,type:wX.arc3d},[UK.labelLine]:{name:UK.labelLine,type:wX.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Hl(lN).bind(this),endAngle:Hl(hN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",W$.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,W$.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Hl(rN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Hl(aN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Hl(sN).bind(this),x:Hl(rN).bind(this),y:Hl(aN).bind(this),text:Hl(nN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Hl(iN).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[xN];return"inside"===this._spec.label?.position?Ml(e):0},limit:Hl(eN).bind(this),...n},void 0,W$.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Hl(sN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const WJ=[10,20],UJ=jl.Linear,GJ="circle",YJ=jl.Ordinal,$J=["circle","square","triangle","diamond","star"];fK.useMark([ZZ,NZ]);class XJ extends Cq{static type=GK.scatter;type=GK.scatter;static mark={...Mq.mark,[UK.point]:{name:UK.point,type:wX.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if($i(e))return e;if(en(e)){if(Xi(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${Jj}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(qi(e)){if(Xi(t))throw new Error(`${s}Field is required.`);const r={id:`${Jj}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return Xi(e)?10:rn(e)?e:!tn(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:UJ,defaultRange:WJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return Xi(e)?GJ:tn(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:YJ,defaultRange:$J},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(XJ.mark.point,{morph:zZ(this._spec.animation,this._spec.morph,LZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:xn({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(DZ(BZ.scatter({},t),LZ(UK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:rn(this._size)||$i(this._size)?this._size:10,shape:tn(this._shape)||$i(this._shape)?this._shape:GJ},hK.STATE_NORMAL,W$.Series),(Ki(this._sizeField)||Ki(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},hK.STATE_NORMAL,W$.User_Mark),(Ki(this._shapeField)||Ki(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},hK.STATE_NORMAL,W$.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||tl(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},hK.STATE_NORMAL,W$.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class KJ extends BJ{getStackGroupFields(){return this._angleField}getStackValueField(){return Cn(this._spec.valueField)[0]||Cn(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(G$),this.setInnerRadiusField(U$)}setValueFieldToPercent(){this.setRadiusField($$),this.setInnerRadiusField(Y$)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}fK.useMark([zJ,NZ]);class qJ extends KJ{static type=GK.rose;type=GK.rose;static mark={...VZ.mark,[UK.rose]:{name:UK.rose,type:wX.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(qJ.mark.rose,{morph:zZ(this._spec.animation,this._spec.morph,LZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(qJ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Gh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Gh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Gh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(Ml(e)??0)+90},void 0,W$.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(DZ(BZ.rose(e,t),LZ(UK.rose,this._spec)))}}}fK.useMark([cJ,iJ,ZZ,NZ]);class ZJ extends KJ{static type=GK.radar;type=GK.radar;static mark={...Mq.mark,...tJ,[UK.area]:{name:UK.area,type:wX.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(ZJ.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:EX},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:kl(this._spec.startAngle)??AN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(DZ(BZ.radarGroup(t,e),LZ(UK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(Ki(i)){const s=BZ[n];i.setAnimationConfig(DZ(s(t,e),LZ(i.name,this._spec)))}}))}}Mn(ZJ,QZ);class JJ extends pq{updateTooltipSpec(){super.updateTooltipSpec(),Ki(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>No.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const QJ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},tQ={fill:"#bbb",fillOpacity:.2};fK.useMark([ZZ,NZ,WZ,jZ]);class eQ extends Cq{static type=GK.dot;type=GK.dot;static mark={...Mq.mark,[UK.group]:{name:UK.group,type:wX.group},[UK.grid]:{name:UK.grid,type:wX.rule},[UK.gridBackground]:{name:UK.gridBackground,type:wX.rect},[UK.dot]:{name:UK.dot,type:wX.symbol},[UK.title]:{name:UK.title,type:wX.text},[UK.subTitle]:{name:UK.subTitle,type:wX.text},[UK.symbol]:{name:UK.symbol,type:wX.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){Ki(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){Ki(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){Ki(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){Ki(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){Ki(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){Ki(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),ZX(this._option.dataSet,"objFlat",QJ),ZX(this._option.dataSet,"copyDataView",nK),JX(this._option.dataSet,"dataview",Lo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){Ki(t)&&(this._seriesField=t,this.getMarksInType([wX.line,wX.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(xn(tQ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(eQ.mark.group),this._containerMark=this._createMark(eQ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(eQ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(eQ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(eQ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(eQ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(eQ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(eQ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",W$.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",W$.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",W$.Series),this._trigger.registerMark(i));const n=this._gridMark;n&&(this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",W$.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",W$.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",W$.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",W$.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(o))}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??N$}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Oh(this._option.getTheme().colorScheme,this.type);return(new Vh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??N$}}initTooltip(){this._tooltipHelper=new JJ(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class iQ extends pq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>No.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}fK.useMark([WZ,ZZ]);class nQ extends Cq{static type=GK.link;type=GK.link;static mark={...Mq.mark,[UK.group]:{name:UK.group,type:wX.group},[UK.link]:{name:UK.link,type:wX.rule},[UK.arrow]:{name:UK.arrow,type:wX.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){Ki(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){Ki(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){Ki(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){Ki(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();ZX(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(nQ.mark.group),this._containerMark=this._createMark(nQ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(nQ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(nQ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",W$.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",W$.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",W$.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?RX.triangleDown:RX.triangleUp},"normal",W$.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??N$}}initTooltip(){this._tooltipHelper=new iQ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class sQ extends BJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=kl(this._spec.startAngle)??kl(t?.startAngle)??AN,this._endAngle=kl(this._spec.endAngle)??kl(t?.endAngle)??kN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||Ki(n?.startAngle)||Ki(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Gh(this.angleAxisHelper.dataToPosition([t[U$]]),this.angleAxisHelper.getScale(0));if(an(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Gh(this.angleAxisHelper.dataToPosition([t[G$]]),this.angleAxisHelper.getScale(0));if(an(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class rQ extends FJ{static type=wX.arc;static constructorType=wX.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){Ki(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),Ki(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const l=Ki(t.innerPadding)&&Ki(a)||Ki(t.outerPadding)&&Ki(o),h=Ki(t.innerRadius)&&s||Ki(t.outerRadius)&&r;if(l||h){const e=Object.assign({},t);return s&&Ki(a)&&($i(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+($i(s)?s(t,e,i,n):s):$i(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&Ki(o)&&($i(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-($i(r)?r(t,e,i,n):r):$i(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}fK.useMark([zJ,rQ]);class aQ extends sQ{static type=GK.circularProgress;type=GK.circularProgress;static mark={...Mq.mark,[UK.track]:{name:UK.track,type:wX.progressArc},[UK.progress]:{name:UK.progress,type:wX.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(aQ.mark.track),this._progressMark=this._createMark(aQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(an(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(an(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(DZ(BZ.circularProgress({startAngle:this._startAngle},t),LZ(UK.progress,this._spec))),this._trackMark.setAnimationConfig(DZ(BZ.progressBackground(),LZ(UK.track,this._spec)))}}class oQ extends pq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}fK.useMark([jZ]);class lQ extends Cq{static type=GK.linearProgress;type=GK.linearProgress;static mark={...Mq.mark,[UK.track]:{name:UK.track,type:wX.rect},[UK.progress]:{name:UK.progress,type:wX.rect},[UK.group]:{name:UK.group,type:wX.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(lQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Gh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Gh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Gh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Gh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(lQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Gh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Gh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(lQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Gh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(uB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Gh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(uB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",W$.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(DZ(BZ.linearProgress(t,e),LZ(UK.progress,this._spec))),this._trackMark.setAnimationConfig(DZ(BZ.progressBackground(),LZ(UK.track,this._spec)))}initTooltip(){this._tooltipHelper=new oQ(this)}}const hQ=[0],cQ=[20,40],dQ=[200,500],uQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},pQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],gQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:fQ,triangle:fQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function fQ(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function mQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const yQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function _Q(t){return $i(t)?t:function(){return t}}class vQ{constructor(t){var e,i;switch(this.options=Object.assign({},vQ.defaultOptions,t),$i(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>gQ[t]?gQ[t]():gQ.circle())(this.options.shape),this.getText=null!==(e=_Q(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=_Q(this.options.fontWeight),this.getTextFontSize=_Q(this.options.fontSize),this.getTextFontStyle=_Q(this.options.fontStyle),this.getTextFontFamily=_Q(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>yQ(10,50);break;case"random-light":this.getTextColor=()=>yQ(50,90);break;default:this.getTextColor=_Q(this.options.color)}if(Xi(this.options.rotate)){if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}}else this.getTextRotate=$i(this.options.rotate)?t=>{var e;return Es(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Es(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!Xi(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class xQ extends vQ{constructor(t){var e;super(Object.assign({},xQ.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.spiral=tn(this.options.spiral)?null!==(e=bQ[this.options.spiral])&&void 0!==e?e:bQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=_Q(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:n}=mQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));for(this.data=r;s>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(kQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(AQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}kQ(p,this._size)&&(p=MQ(p,this._size))}else if(kQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||wQ(p,i))&&(!i||!SQ(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function SQ(t,e,i){const n=i[0]>>5,s=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function wQ(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,kQ=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function MQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),Pn(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=mQ(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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(;ie.left+e.width||t.top>e.top+e.height)}TQ.defaultOptions={enlarge:!1};const RQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},PQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?BQ(t.fontFamily):"sans-serif",u=t.fontStyle?BQ(t.fontStyle):"normal",p=t.fontWeight?BQ(t.fontWeight):"normal",g=t.rotate?BQ(t.rotate):0,f=BQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?BQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",v=null!==(r=t.shrink)&&void 0!==r&&r,b=null!==(a=t.enlarge)&&void 0!==a&&a,x=null!==(o=t.clip)&&void 0!==o&&o,S=null!==(l=t.minFontSize)&&void 0!==l?l:0,w=t.randomVisible,A=t.as||RQ,k=t.depth_3d,M=t.postProjection;let C=t.fontSize?BQ(t.fontSize):14;const T=t.fontSizeRange;if(T&&!rn(C)){const t=C;C=e=>IQ(t(e),DQ(t,h),T)}let E=xQ;"fast"===t.layoutType?E=TQ:"grid"===t.layoutType&&(E=CQ);const R=new E({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:C,shrink:v,clip:x,enlarge:b,minFontSize:S,random:w,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},BQ=t=>tn(t)||rn(t)||$i(t)?t:e=>e[t.field],IQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],DQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function LQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),zQ=(t,e)=>{let i=0;for(const e of t)FQ(e)?i+=1:i+=.53;return i};function HQ(t){return on(t)?new Promise(((e,i)=>{const n=mB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{ll().error("image 加载失败!",t)}})):null}var jQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function NQ(t){return jQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield HQ(e);r&&(a=yield function(t,e,i){return jQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&WQ(s,n,a-1);)--a;for(;oo&&UQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield HQ(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||VQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function VQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function WQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=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")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||XQ(e,t,r)))return $Q(e,t,r),!0}return!1}function $Q(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function XQ(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function KQ(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(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,s,u).data;let f,m;for(;--n>=p;){const t=i[n];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;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(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 qQ(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=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++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=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?GQ(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=qQ(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return GQ(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){KQ(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!XQ(i,y,_)&&($Q(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var QQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const t0={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},e0=(t,e,i,n)=>QQ(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||hl("WordcloudShape shape must be specified."),t.text||hl("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(OQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||t0;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=yj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield NQ(l),p=t.colorMode||"ordinal",g={getText:a0(t.text),getFontSize:a0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?a0(t.colorField):a0(t.text),getFillingColor:a0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:a0(t.colorHexField),getFontFamily:a0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:a0(t.padding||1),getFontStyle:a0(t.fontStyle||"normal"),getFontWeight:a0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?a0(t.fontOpacity):()=>1};n0(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:a0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:a0(t.fillingFontStyle||"normal"),getFillingFontWeight:a0(t.fillingFontWeight||"normal"),getFillingPadding:a0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((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{const i=zQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,R=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),P=Math.max(...R.map((t=>t.fontSize)));R.forEach((t=>t.weight=t.fontSize/P)),R.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield JQ(R,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(OQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),i0=(t,e,i,n)=>{var s,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 Yl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Yl).domain(e).range(f).scale(t)}}else(new xh).domain(r0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new xh).domain(r0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},n0=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new Eh).domain(r0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&$i(s)&&!n){const e=.5,[o,l]=(i.shapeArea,r0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=s0(h,i,!0);n=[~~(e*c),~~c];const d=(new Eh).domain(r0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=s0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},s0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=zQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},a0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:$i(t)?t:e=>e[t.field]:null,o0=`${Jj}_WORD_CLOUD_ANGLE`,l0=`${Jj}_WORD_CLOUD_FILLING_ANGLE`,h0=`${Jj}_WORD_CLOUD_WEIGHT`,c0=`${Jj}_WORD_CLOUD_TEXT`;fK.useMark([NZ]),PN("wordcloud",{transform:PQ,markPhase:"beforeJoin"},!0),PN("wordcloudShape",{transform:e0,markPhase:"beforeJoin"},!0);class d0 extends Mq{static mark={...Mq.mark,[UK.word]:{name:UK.word,type:wX.text},[UK.fillingWord]:{name:UK.fillingWord,type:wX.text}};_nameField;_valueField;setValueField(t){Ki(t)&&(this._valueField=t,this.setFontSizeRange(cQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){Ki(t)&&Ki(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??dQ,this._rotateAngles=this._spec.rotateAngles??hQ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:uQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:hQ,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!pQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(d0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(d0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?c0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",W$.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(DZ(BZ.wordCloud(),LZ(UK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Oh(this._option.getTheme().colorScheme,this.type);return(new Vh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??N$};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new xh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=yl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:h0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:o0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:l0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:c0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?c0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:j$,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?c0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:Ko(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:j$,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:o0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class u0 extends d0{static type=GK.wordCloud;type=GK.wordCloud}class p0 extends d0{static type=GK.wordCloud3d;type=GK.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new xh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=yl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:h0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:o0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:l0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:c0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?c0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:j$,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:j$,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:o0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:h0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(d0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(d0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",W$.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(DZ(BZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),LZ(UK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(DZ(BZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),LZ(UK.fillingWord,this._spec)))}}const g0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=an(y*f)?y/f:null,b=an(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:b),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},f0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},m0=`${Jj}_FUNNEL_TRANSFORM_RATIO`,y0=`${Jj}_FUNNEL_REACH_RATIO`,_0=`${Jj}_FUNNEL_HEIGHT_RATIO`,v0=`${Jj}_FUNNEL_VALUE_RATIO`,b0=`${Jj}_FUNNEL_LAST_VALUE_RATIO`,x0=`${Jj}_FUNNEL_NEXT_VALUE_RATIO`,S0=`${Jj}_FUNNEL_LAST_VALUE`,w0=`${Jj}_FUNNEL_CURRENT_VALUE`,A0=`${Jj}_FUNNEL_NEXT_VALUE`,k0=`${Jj}_FUNNEL_TRANSFORM_LEVEL`,M0=20;class C0 extends pq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===UK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===UK.transform){const e=t?.[y0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===UK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return Ki(n[0])?t?.[n[0]]:t?.[s]}}class T0 extends NK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class E0 extends T0{static type=wX.polygon;type=E0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}fK.useMark([E0,NZ,WZ]);class R0 extends Mq{static type=GK.funnel;type=GK.funnel;_funnelMarkName=UK.funnel;_funnelMarkType=wX.polygon;_transformMarkName=UK.transform;_transformMarkType=wX.polygon;static mark={...Mq.mark,[UK.funnel]:{name:UK.funnel,type:wX.polygon},[UK.transform]:{name:UK.transform,type:wX.polygon},[UK.transformLabel]:{name:UK.transformLabel,type:wX.text},[UK.outerLabel]:{name:UK.outerLabel,type:wX.text},[UK.outerLabelLine]:{name:UK.outerLabelLine,type:wX.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",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._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;ZX(this._dataSet,"funnel",g0),ZX(this._dataSet,"funnelTransform",f0);const t=new jo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Jj}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new vq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:w0,asTransformRatio:m0,asReachRatio:y0,asHeightRatio:_0,asValueRatio:v0,asNextValueRatio:x0,asLastValueRatio:b0,asLastValue:S0,asNextValue:A0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:k0}})}initMark(){if(this._funnelMark=this._createMark({...R0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:zZ(this._spec.animation,this._spec.morph,LZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...R0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(R0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(R0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(R0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(R0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new C0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>Ki(t[this._valueField]),fill:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",W$.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",W$.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Hl(y0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",W$.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",W$.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",W$.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(DZ(BZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),LZ(UK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(DZ(BZ.funnel({},t),LZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(DZ(BZ.label(),LZ(UK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[b0])/2:this._getSecondaryAxisLength(t[v0])/2,s=this._getSecondaryAxisLength(t[v0])/2):(n=this._getSecondaryAxisLength(t[v0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[x0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[k0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return Ki(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!Ki(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(rn(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-M0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",W$.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",W$.Series)}}function I0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==s?void 0:s.key)&&void 0!==h?h:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=O0(t.children,d.children,i+1,o,d,r);d.value=Xi(t.value)?e.sum:Math.max(e.sum,d.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=Xi(t.value)?0:t.value;a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},F0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=F0(t.children,e,t,s))})),n},z0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=z0(t.children,e,t,s)),s=e(t,n,i,s)})),s},H0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:I0,slice:D0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?D0:I0)(t,e,i,n,s)}};class j0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=en(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},j0.defaultOpionts,t);const i=this.options.nodeKey,n=$i(i)?i:i?dl(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?L0(this.options.aspectRatio):null!==(e=H0[this.options.splitType])&&void 0!==e?e:H0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},s=[],r=O0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(rn(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(rn(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}j0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const N0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class V0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];I0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),N0);const n=en(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],n)return this._layoutLabel(t,Yi(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},V0.defaultOpionts,t):Object.assign({},V0.defaultOpionts);const e=this.options.nodeKey,i=$i(e)?e:e?dl(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+vl(this.options.center[0],t.width),n=t.y0+vl(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=en(r),l=o?r.map((t=>vl(t,s))):vl(r,s),h=en(a),c=this.options.gapRadius,d=h?a.map((t=>vl(t,s))):vl(a,s),u=Bn(0,e+1);if(o)this._parsedInnerRadius=u.map(((t,e)=>{const i=l[e];return Xi(i)?s:i})),this._parsedOutterRadius=u.map(((t,i)=>{var n;return h?d[i]:iXi(d[e])?s:d[e])),this._parsedInnerRadius=u.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(en(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=vl(r,s),i=(d-t)/(e+1);this._parsedInnerRadius=u.map(((e,n)=>t+n*i)),this._parsedOutterRadius=u.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(en(c)?null!==(n=c[e])&&void 0!==n?n:0:c)}))}this._parsedCenter=[i,n],this._maxRadius=s}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],s=O0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Is({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}V0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const W0=4294967296;function U0(t,e){let i,n;if($0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function $0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function Z0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function J0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function Q0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function t1(t){return{_:t,next:null,prev:null}}function e1(t,e){const i=(t=Cn(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];Z0(s,n,r);let a,o,l,h,c,d,u,p=t1(n),g=t1(s),f=t1(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:en(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const l=[],h=O0(t,l,0,-1,null,this._getNodeKey);this._maxDepth=h.maxDepth;const c=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%W0)/W0}(),d={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:h.sum,datum:null,children:l,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=$i(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:r1.defaultOpionts.nodeSort;F0([d],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)F0([d],i1(this.options.setRadius)),z0([d],n1(this._getPadding,.5,c)),F0([d],s1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);F0([d],i1(r1.defaultOpionts.setRadius)),z0([d],n1(pl,1,c)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&z0([d],n1(this._getPadding,d.radius/t,c)),F0([d],s1(t/(2*d.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[d]:l}}r1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const a1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):a1(t.children,e,i)))})),e},o1=(t,e={})=>{if(!t)return[];const i=[];return a1(t,i,e),i},l1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new V0(i).layout(t,{width:n,height:s})};class h1 extends pq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var c1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(c1||(c1={}));const d1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(Xi(s))return t;if(i.type===c1.DrillDown){return Cn(_X(t,s,n,"children"))}if(i.type===c1.DrillUp){const e=vX(t,s,n,"children");if(e)return Cn(e)}return t};class u1{pointerId;parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}parserDragEvent(){return!0}}class p1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!0)}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}}const g1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:u1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:u1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:p1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:p1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:p1}};class f1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return g1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===n.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;ZX(t,"drillFilter",d1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(Xi(t.datum)||Xi(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!en(t)||un(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:c1.DrillDown},e().reRunAllTransform(),i.emit(L$.drill,{value:{path:t,type:c1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!en(i)||un(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:c1.DrillUp},t().reRunAllTransform(),e.emit(L$.drill,{value:{path:i,type:c1.DrillUp},model:this}),i}}fK.useMark([zJ,NZ]);class m1 extends BJ{static type=GK.sunburst;type=GK.sunburst;static mark={...Mq.mark,[UK.sunburst]:{name:UK.sunburst,type:wX.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??xq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??j$,getRawData:()=>this.getRawData()}),this._startAngle=Es(this._spec.startAngle),this._endAngle=Es(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),ZX(this._dataSet,"sunburstLayout",l1),ZX(this._dataSet,"flatten",o1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[Ki(this._centerX)?this._centerX:this.getLayoutRect().width/2,Ki(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:bq,operations:["max","min","values"]},{key:xq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();Xi(t?.dataSet)||(ZX(t.dataSet,"addVChartProperty",nq),t.transform({type:"addVChartProperty",options:{beforeCall:wq,call:kq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(m1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){Xi(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(Ki(this._offsetX)?this._offsetX:0),y:t=>t.y+(Ki(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},hK.STATE_NORMAL,W$.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(m1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){Xi(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return qi(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(Ki(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(Ki(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},hK.STATE_NORMAL,W$.Series)}initTooltip(){this._tooltipHelper=new h1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(Cn(this.__innerRadius))[0],outerRadius:this._computeRadius(Cn(this.__outerRadius))[0],startAngle:Cn(this._startAngle)[0],endAngle:Cn(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(wX.arc).forEach((i=>{i.setAnimationConfig(DZ(BZ.sunburst(t,e),LZ(i.name,this._spec)))})),this.getMarksInType(wX.text).forEach((t=>{t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(en(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}Mn(m1,f1);const y1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new r1(i).layout(t,{width:n,height:s})};class _1 extends pq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}fK.useMark([zJ,NZ]);class v1 extends Cq{static type=GK.circlePacking;type=GK.circlePacking;static mark={...Mq.mark,[UK.circlePacking]:{name:UK.circlePacking,type:wX.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??xq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??j$,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();Xi(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),ZX(this._dataSet,"circlePackingLayout",y1),ZX(this._dataSet,"flatten",o1),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{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();Xi(t?.dataSet)||(ZX(t.dataSet,"addVChartProperty",nq),t.transform({type:"addVChartProperty",options:{beforeCall:wq,call:kq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(v1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){Xi(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},hK.STATE_NORMAL,W$.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(v1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){Xi(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},hK.STATE_NORMAL,W$.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:bq,operations:["max","min","values"]},{key:xq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new _1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(wX.arc).forEach((e=>{e.setAnimationConfig(DZ(BZ.circlePacking({},t),LZ(e.name,this._spec)))})),this.getMarksInType(wX.text).forEach((t=>{t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}Mn(v1,f1);const b1=t=>{let e=0;return t.forEach(((t,i)=>{var n;Xi(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=b1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function x1(t){return t.depth}function S1(t,e){return e-1-t.endDepth}const w1=(t,e)=>t.y0-e.y0,A1={left:x1,right:S1,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?En(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:x1,end:S1};class k1{constructor(t){this._ascendingSourceBreadth=(t,e)=>w1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>w1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},k1.defaultOptions,t);const e=this.options.nodeKey,i=$i(e)?e:e?dl(e):null;this._getNodeKey=i,this._alignFunc=$i(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):A1[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];b1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(Xi(s.source)||Xi(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&hl("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&hl("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(tn(e)){const t=Kn(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(rn(e)){if(r=e,rn(i))a=i;else if(Xi(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else $i(e)&&rn(i)&&(a=i);const l=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}Xi(this.options.nodeSortBy)&&s.sort(w1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(w1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new k1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},C1=(t,e)=>{if(!t||!e?.view||!en(t))return t;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 t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new k1(e),s=[];return s.push(n.layout(t,i)),s},T1=t=>t&&en(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],E1=t=>t&&en(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class R1 extends pq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(rn(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class P1 extends NK{static type=wX.linkPath;type=P1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){ZN("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(lW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),QV("linkPathGrowIn",hW),QV("linkPathGrowOut",cW),QV("linkPathUpdate",dW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}fK.useMark([jZ,P1,NZ]),PN("sankey",{transform:M1,markPhase:"beforeJoin"},!0);class B1 extends Cq{static type=GK.sankey;type=GK.sankey;static mark={...VZ.mark,[UK.node]:{name:UK.node,type:wX.rect},[UK.link]:{name:UK.link,type:wX.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=J$.Node;_labelLayoutZIndex=J$.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Cs;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){ZX(this._dataSet,"sankey",C1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new zo;JX(t,"dataview",Lo),ZX(t,"sankeyNodes",T1),ZX(t,"addVChartProperty",nq);const e=new jo(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1),this._nodesSeriesData=new vq(this._option,e);const i=new zo;JX(i,"dataview",Lo),ZX(i,"sankeyLinks",E1),ZX(i,"addVChartProperty",nq);const n=new jo(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:wq,call:Aq.bind(this)}},!1),this._linksSeriesData=new vq(this._option,n)}}initMark(){const t=this._createMark(B1.mark.node,{isSeriesMark:!0,key:H$,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(B1.mark.link,{key:H$,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(B1.mark.label,{key:H$,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},hK.STATE_NORMAL,W$.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},hK.STATE_NORMAL,W$.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},hK.STATE_NORMAL,W$.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},hK.STATE_NORMAL,W$.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(DZ(BZ.sankeyNode(t,e),LZ(UK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(DZ(BZ.sankeyLinkPath(),LZ(UK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(DZ(BZ.label(),LZ(UK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:F$.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:F$.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:F$.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:F$.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(Cn(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||Cn(s[r]).includes(e.source)&&Cn(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(Cn(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new R1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Oh(this._option.getTheme().colorScheme,this.type),n=new Vh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const I1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new j0(e).layout(t,i)},D1=(t,e)=>{let i={},n=e.fields;if($i(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=o1(s);return i=yq([{latestData:r}],e),i};class L1 extends pq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class O1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,g1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return g1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:F$.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:F$.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;Xi(s)||Kh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){g1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){g1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){g1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){g1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:F$.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:F$.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;Xi(s)&&Xi(r)||Kh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:F$.chart},(t=>{if(!t.event)return;const{event:n}=t;Kh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:F$.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){g1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:F$.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){g1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:F$.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:F$.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:F$.chart,source:O$.chart},l),this._eventObj.off(n,{level:F$.chart,source:O$.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:F$.chart,source:O$.chart},l),this._eventObj.on(n,{level:F$.chart,source:O$.chart},o)}}fK.useMark([jZ,NZ]);class F1 extends Cq{static type=GK.treemap;type=GK.treemap;static mark={...Mq.mark,[UK.nonLeaf]:{name:UK.nonLeaf,type:wX.rect},[UK.leaf]:{name:UK.leaf,type:wX.rect},[UK.nonLeafLabel]:{name:UK.nonLeafLabel,type:wX.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Cs;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??xq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ls),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??j$,getRawData:()=>this.getRawData()}),an(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),ZX(this._dataSet,"treemap",I1),ZX(this._dataSet,"flatten",o1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(ZX(this._rawData.dataSet,"addVChartProperty",nq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:wq,call:kq.bind(this)}}))}_statisticRawData(){const t=`${Jj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){ZX(this._dataSet,"hierarchyDimensionStatistics",D1),ZX(this._dataSet,"flatten",o1);const i=new jo(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 super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:bq,operations:["max","min","values"]},{key:xq,operations:["values"]}])}initMark(){const t=this._createMark(F1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(F1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(F1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(F1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},hK.STATE_NORMAL,W$.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()},hK.STATE_NORMAL,W$.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},hK.STATE_NORMAL,W$.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},hK.STATE_NORMAL,W$.Series)}initAnimation(){this.getMarksInType(wX.rect).forEach((t=>{t.setAnimationConfig(DZ(BZ.treemap(),LZ(t.name,this._spec)))})),this.getMarksInType(wX.text).forEach((t=>{t.setAnimationConfig(DZ(BZ.label(),LZ(t.name,this._spec)))}))}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 L1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(uV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(uV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}Mn(F1,O1),Mn(F1,f1),fK.useMark([CJ,jZ]);class z1 extends sQ{static type=GK.gaugePointer;type=GK.gaugePointer;static mark={...Mq.mark,[UK.pin]:{name:UK.pin,type:wX.path},[UK.pinBackground]:{name:UK.pinBackground,type:wX.path},[UK.pointer]:{name:UK.pointer,type:[wX.path,wX.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?wX.rect:wX.path}initMark(){this._pinBackgroundMark=this._createMark(z1.mark.pinBackground),this._pointerMark=this._createMark({...z1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(z1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===wX.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return Ki(this.radiusAxisHelper)&&Ki(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(DZ(BZ.circularProgress({startAngle:this._startAngle},t),LZ(UK.pointer,this._spec)))}}fK.useMark([rQ]);class H1 extends sQ{static type=GK.gauge;type=GK.gauge;static mark={...Mq.mark,[UK.segment]:{name:UK.segment,type:wX.progressArc},[UK.track]:{name:UK.track,type:wX.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=kl(this._spec.padAngle??0)}initData(){super.initData();ZX(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[Z$]=t[this._angleField[0]],t[q$]=e>0?i[e-1][Z$]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(H1.mark.track),this._segmentMark=this._createMark(H1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(Ki(t[q$])?this.angleAxisHelper.dataToPosition([t[q$]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[Z$]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(DZ(BZ.circularProgress({startAngle:this._startAngle},t),LZ(UK.segment,this._spec)))}}class j1 extends pq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return Ki(i)&&"dimension"===t&&(i.visible=!1),i}}class N1 extends qZ{static type=wX.cell;type=N1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}fK.useMark([N1,NZ]);class V1 extends Cq{static type=GK.heatmap;type=GK.heatmap;static mark={...Mq.mark,[UK.cell]:{name:UK.cell,type:wX.cell},[UK.cellBackground]:{name:UK.cellBackground,type:wX.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Cn(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(V1.mark.cell,{morph:zZ(this._spec.animation,this._spec.morph,LZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:xn({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(V1.mark.cellBackground,{progressive:t})}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",W$.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=Tr(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",W$.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(DZ(BZ.heatmap(t),LZ(UK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new j1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}fK.useSeries([dJ]);class W1 extends qK{static type=YK.area;static view="singleDefault";type=YK.area;seriesType=GK.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([VZ]);class U1 extends qK{static type=YK.bar;static view="singleDefault";type=YK.bar;seriesType=GK.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([rJ]);class G1 extends qK{static type=YK.bar3d;static view="singleDefault";type=YK.bar3d;seriesType=GK.bar3d}fK.useSeries([JZ]);class Y1 extends qK{static type=YK.boxPlot;static view="singleDefault";type=YK.boxPlot;seriesType=GK.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??$h.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===$h.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),ZK(t)}}fK.useSeries([v1]);class $1 extends KK{static type=YK.circlePacking;static view="singleDefault";type=YK.circlePacking;seriesType=GK.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=GK.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class X1 extends KK{static type=YK.common;static view="singleDefault";type=YK.common}class K1 extends KK{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([R0]);class q1 extends K1{static type=YK.funnel;static view="singleDefault";type=YK.funnel;seriesType=GK.funnel}fK.useSeries([B0]);class Z1 extends K1{static type=YK.funnel3d;static view="singleDefault";type=YK.funnel3d;seriesType=GK.funnel3d}const J1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Q1(t){let e=0;return pn(t,"tick.visible")&&(e+=pn(t,"tick.tickSize")),pn(t,"label.visible")&&(e+=pn(t,"label.space")),e}function t2(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function e2(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function i2(t){const e=t?.orient;return"angle"===e||"radius"===e}const n2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return xn({},o,("band"===e?n:"linear"===e?s:{})??{},BX(t)?r:a)},s2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return xn({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class r2 extends KK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=Cn(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return Ki(i)&&e.forEach((t=>{Xi(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],Ki(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class a2 extends r2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),Xi(n.angle.type)&&(n.angle.type="linear"),Xi(n.radius.type)&&(n.radius.type="band");const s=t2(n.angle,{min:0,max:1});Xi(n.angle.min)&&(n.angle.min=s.min),Xi(n.angle.max)&&(n.angle.max=s.max)}}fK.useSeries([z1,H1]);class o2 extends a2{static type=YK.gauge;static view="singleDefault";type=YK.gauge;seriesType=GK.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:GK.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===GK.gauge||t.type===GK.circularProgress));Xi(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&Xi(e.radiusField)&&Xi(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===GK.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),Xi(e.angle.type)&&(e.angle.type="linear"),Xi(e.radius.type)&&(e.radius.type="linear")}}fK.useSeries([V1]);class l2 extends qK{static type=YK.heatmap;static view="singleDefault";type=YK.heatmap;seriesType=GK.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class h2 extends qK{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}fK.useSeries([VZ]);class c2 extends h2{static type=YK.histogram;static view="singleDefault";type=YK.histogram;seriesType=GK.bar;transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([rJ]);class d2 extends h2{static type=YK.histogram3d;static view="singleDefault";type=YK.histogram3d;seriesType=GK.bar3d}fK.useSeries([nJ]);class u2 extends qK{static type=YK.line;static view="singleDefault";type=YK.line;seriesType=GK.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([PJ]);class p2 extends KK{static type=YK.map;static view="singleDefault";type=YK.map;seriesType=GK.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area}}isValidSeries(t){return t===GK.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class g2 extends r2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}fK.useSeries([jJ]);class f2 extends g2{static type=YK.pie;static view="singleDefault";type=YK.pie;seriesType=GK.pie}fK.useSeries([VJ]);class m2 extends g2{static type=YK.pie3d;static view="singleDefault";type=YK.pie3d;seriesType=GK.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}fK.useSeries([aQ]);class y2 extends a2{static type=YK.circularProgress;static view="singleDefault";type=YK.circularProgress;seriesType=GK.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}fK.useSeries([lQ]);class _2 extends qK{static type=YK.linearProgress;static view="singleDefault";type=YK.linearProgress;seriesType=GK.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),Xi(i.type)&&(i.type="band"),Xi(e.type)&&(e.type="linear");const n=t2(e,{min:0,max:1});Xi(e.min)&&(e.min=n.min),Xi(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),Xi(i.type)&&(i.type="linear"),Xi(e.type)&&(e.type="band");const n=t2(i,{min:0,max:1});Xi(i.min)&&(i.min=n.min),Xi(i.max)&&(i.max=n.max)}}}class v2 extends r2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}fK.useSeries([ZJ]);class b2 extends v2{static type=YK.radar;static view="singleDefault";type=YK.radar;seriesType=GK.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:xn({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=Cn(t.crosshair||{}).map((t=>xn({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}fK.useSeries([pJ]);class x2 extends qK{static type=YK.rangeArea;static view="singleDefault";type=YK.rangeArea;seriesType=GK.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===$h.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([lJ]);class S2 extends qK{static type=YK.rangeColumn;static view="singleDefault";type=YK.rangeColumn;seriesType=GK.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===$h.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),ZK(t)}}fK.useSeries([hJ]);class w2 extends qK{static type=YK.rangeColumn3d;static view="singleDefault";type=YK.rangeColumn3d;seriesType=GK.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===$h.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}fK.useSeries([qJ]);class A2 extends v2{static type=YK.rose;static view="singleDefault";type=YK.rose;seriesType=GK.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??TN,outerRadius:t.outerRadius??TN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=Cn(t.crosshair||{}).map((t=>xn({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}fK.useSeries([B1]);class k2 extends KK{static type=YK.sankey;static view="singleDefault";type=YK.sankey;seriesType=GK.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([XJ]);class M2 extends qK{static type=YK.scatter;static view="singleDefault";type=YK.scatter;seriesType=GK.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}fK.useSeries([eQ,nQ]);class C2 extends KK{static type=YK.sequence;static view="singleDefault";type=YK.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==GK.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[GK.bar,GK.line,GK.area,GK.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===GK.dot?"band":"linear",visible:t.type!==GK.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===GK.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===GK.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=rK(t.data,this._dataSet,this._spec.data),t.type===GK.link&&(t.dataDot=rK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===GK.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===GK.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=AX.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}fK.useSeries([m1]);class T2 extends KK{static type=YK.sunburst;static view="singleDefault";type=YK.sunburst;seriesType=GK.sunburst;getDefaultSeriesSpec(t){const e=Ki(t.startAngle)?t.startAngle:MN,i=Ki(t.endAngle)?t.endAngle:e+Rs(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=GK.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([F1]);class E2 extends KK{static type=YK.treemap;static view="singleDefault";type=YK.treemap;seriesType=GK.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([UZ]);class R2 extends U1{static type=YK.waterfall;static view="singleDefault";type=YK.waterfall;seriesType=GK.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&Cn(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),ZK(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class P2 extends KK{type=YK.wordCloud;seriesType=GK.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}fK.useSeries([u0]);class B2 extends P2{static type=YK.wordCloud;static view="singleDefault";type=YK.wordCloud;seriesType=GK.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}fK.useSeries([p0]);class I2 extends P2{static type=YK.wordCloud3d;static view="singleDefault";type=YK.wordCloud3d;seriesType=GK.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class D2{plugins;id=Qo();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Uo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this.plugins.find((e=>e.id===t))}getAll(){return this.plugins.slice()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function L2(t){const e={...t};return un(t.style)||(e.textStyle=SX(t.style)),un(t.textStyle)||xn(e.textStyle,SX(t.textStyle)),t.shape?.style&&SX(e.shape.style),t.background?.style&&SX(e.background.style),e}function O2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class F2 extends kK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new D2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new BK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case n.cartesianBandAxis:return n2(LX(i),"band",e);case n.cartesianLinearAxis:return n2(LX(i),"linear",e);case n.cartesianAxis:case n.cartesianTimeAxis:return n2(LX(i),void 0,e);case n.polarBandAxis:return s2(i.orient,"band",e);case n.polarLinearAxis:return s2(i.orient,"linear",e);case n.polarAxis:return s2(i.orient,void 0,e);case n.cartesianCrosshair:case n.polarCrosshair:return e.component?.crosshair;case n.colorLegend:return e.component?.colorLegend[O2(i)];case n.sizeLegend:return e.component?.sizeLegend[O2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),en(this._originalSpec)?this._spec=this._originalSpec.map((t=>xn({},this._theme,t))):this._spec=xn({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:O$.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const z2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(Xi(a)||Xi(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},H2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{Xi(i[e])||t.latestData.forEach((t=>{Cn(i[e]).forEach((i=>{Xi(t[i])||(Xi(o[t[i]])&&(o[t[i]]=0),Xi(n[e])||(o[t[i]]+=parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class j2 extends F2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else zl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),zl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=LX(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?$h.horizontal:$h.vertical)===$h.horizontal,Ki(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(Ki(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):Ki(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),Xi(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Nl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(Ki(t)&&(Ki(t.userId)&&(this._seriesUserId=Cn(t.userId)),Ki(t.specIndex)&&(this._seriesIndex=Cn(t.specIndex))),Ki(this._spec.seriesId)){const t=Cn(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(Ki(this._spec.seriesIndex)){const t=Cn(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(Ki(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Cn(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(Ki(this._spec.regionId)){const t=Cn(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(Nl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];let n=!1;if(this._relatedAxisComponent){const s={};zl(this._regions,(r=>{const a="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,o="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!a||!o)return;const l=a.getAxisId()===this._relatedAxisComponent.id?a:o.getAxisId()===this._relatedAxisComponent.id?o:this._isHorizontal?a:o,h=l===a?o:a,c=Nl(h.getScale(0).type);c&&(n=!0),t.push(r.getRawData());const d=r.getSpec(),u=Cn(d.xField),p=Cn(d.yField),g="cartesian"===r.coordinate?u[u.length-1]:d.angleField??d.categoryField,f="cartesian"===r.coordinate?p[p.length-1]:d.radiusField??d.valueField;if(s[r.id]="link"===r.type?"from_xField":l===a?g:f,e.push(s[r.id]),this._valueField){const t="link"===r.type?"from_yField":h===a?g:f;i.push(c?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else n=Xi(this._spec.valueField),zl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;JX(s,"dataview",Lo),ZX(s,"dataFilterComputeDomain",H2);const r=new jo(s);r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:n?this._valueField:null}}},!1),this._data=new zK(this._option,r),r.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&Nl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&Nl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Nl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new hh,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(ZX(this._option.dataSet,"dataFilterWithNewDomain",z2),zl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>Nl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Nl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=Kn(this._start-s,0,1),a=Kn(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}Mn(j2,O1);class N2 extends j2{static type=n.scrollBar;type=n.scrollBar;name=n.scrollBar;layoutZIndex=J$.DataZoom;layoutLevel=Q$.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(Xi(i))return;if(!en(i))return new N2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new N2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return rn(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return rn(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new eU({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(L$.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return Xi(i)||(n.padding=i),un(t?.style)||(n.railStyle=SX(t.style)),un(e?.style)||(n.sliderStyle=SX(e.style)),n}}class V2 extends j2{static type=n.dataZoom;type=n.dataZoom;name=n.dataZoom;layoutZIndex=J$.DataZoom;layoutLevel=Q$.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(Xi(i))return;if(!en(i))return new V2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new V2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize)}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new xh;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return rn(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return rn(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._stateScale:this._valueScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().x+e};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?this._valueScale:this._stateScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().y+e};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new _G({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(L$.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:SX(this._spec.background?.style),startHandlerStyle:SX(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:SX(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:SX(this._spec.middleHandler.background?.style)}},endHandlerStyle:SX(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:SX(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:SX(this._spec.endText?.style)},selectedBackgroundStyle:SX(this._spec.selectedBackground.style),dragMaskStyle:SX(this._spec.dragMask?.style),backgroundChartStyle:{line:xn(SX(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...SX(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:xn(SX(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...SX(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class W2 extends F2{static type=n.customMark;type=n.customMark;layoutType="absolute";layoutZIndex=J$.CustomMark;layoutLevel=Q$.CustomMark;static createComponent(t,e){return t.customMark?[new W2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Jj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Jj}_${n}`});if(s&&(Xi(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),Ki(t.dataId)||an(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class U2 extends F2{layoutType="absolute";static type=n.brush;type=n.brush;name=n.brush;layoutZIndex=J$.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!Xi(i)&&!1!==i.visible)return[new U2(i,{...e,specKey:U2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new fY({zIndex:this.layoutZIndex,brushStyle:SX(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=L$.brushChange;r="brushStart"===n||"brushDown"===n?L$.brushStart:"brushEnd"===n||"brushMaskUp"===n?L$.brushEnd:L$.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{...SX(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&vr(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&_r(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){Ki(this._spec.regionId)&&Ki(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Cn(this._spec.regionId),Cn(this._spec.regionIndex))}_bindLinkedSeries(){Ki(this._spec.brushLinkSeriesId)&&Ki(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Cn(this._spec.brushLinkSeriesId),Cn(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&Cn(t).includes(s.userId)||e&&Cn(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var G2;function Y2(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function $2(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function X2(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:$2(t.rect),anchorCandidates:t3(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>Y2(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;tY2(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function K2(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=mr(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=J2(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=Ya(r,n,i);if(!J2(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],q2(Z2(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=q2(Z2(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=Q2(t.rect,a,0),t}));return X2(h)}function q2(t){return t>180?t-360:t}function Z2(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function J2(t,e){for(let i=0;i{const{x:r,y:a}=Q2({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(G2||(G2={}));class e3 extends F2{static type=n.mapLabel;type=n.mapLabel;name=n.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=J$.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!Ki(i.series)?new e3(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new jo(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new zK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new RG({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=Qh(this._spec.background?.padding),c=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const d={},u=this.dataToPosition(t),p=hB({});if(p.name=`${this.name}_marker_itemContainer_${e}`,d.container=p,this._spec.background?.visible){const t=uB(SX({...this._spec.background.style}));t.setAttributes(u),d.labelBackground=t,p.appendChild(t)}if(this._spec.icon?.visible){const t=fB(SX({...this._spec.icon.style}));t.setAttributes(u),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;d.icon=t,p.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=gB(SX({...this._spec.nameLabel.style}));e.setAttributes(u),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;d.nameLabel=e,p.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&Ki(t[this.valueField])){const e=gB(SX({...this._spec.valueLabel.style}));e.setAttributes(u),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;d.valueLabel=e,p.appendChild(e),a=Math.max(a,s),r+=o,i++}const g=Object.values(d).find((t=>!!t&&"group"!==t.type)),f={x:g?.getComputedAttribute("x"),y:g?.getComputedAttribute("y")},m={x:f.x,y:f.y,width:0,height:0};m.width=n+r+(i-1)*c,m.height=s+a;const y={rect:m,point:f,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));y.rect=Q2(m,o,l),y.anchors=t,y.offset=l}else y.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:y,contentMarks:d}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:SX({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):X2(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class i3{id;name;service;static Name;constructor(t=i3.Name){this.id=Qo(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function n3(t,e){const i=e.getSpec?.();un(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=BX(e.layoutOrient),r=t[0],a=Tn(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);n3(n?n.getChildren():[],t.component),n3(s?s.getChildren():[],t.component)}}function r3(t){return 2===t.length&&an(t[0])&&an(t[1])&&t[1]>=t[0]}function a3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!an(a.min),extendable_max:!an(a.max)}}function o3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function l3(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function h3(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function c3(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const d3=(t,e)=>t.map(((t,i)=>({index:i,value:t,label:e.labelFormatter?e.labelFormatter(t):`${t}`}))),u3=(t,e,i=0)=>{const n=new Ts(t).expand(i/2),s=new Ts(e).expand(i/2);return n.intersects(s)},p3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function f3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=kl(-90));const u=pX(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Ts).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},y3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return d3(p,r.options)};class _3 extends i3{Name="AxisSyncPlugin";constructor(){super(_3.Name)}_checkEnableSync(t){if(!Nl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(L$.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!Nl(i.type)||!Nl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!r3(s)||!r3(r))return;const a=a3(t,s),o=a3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!l3(a,o))return}else if(0===p&&0===g){if(!l3(o,a))return}else if(u||y)if(u&&!y){if(!o3(a,o))return}else if(y&&!u){if(!o3(o,a))return}else{if(h===g)return;if(h>g){if(!h3(a,o))return}else if(!h3(o,a))return}else{if(0===h&&0===p){if(!c3(a,o))return}else if(0===g&&0===l&&!c3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){ZX(e.getOption().dataSet,"tickAlign",y3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var v3={AxisLabelOverlapPlugin:s3,AxisSyncPlugin:_3};const b3=t=>t,x3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!g3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},S3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?p3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return d3(t.domain(),e);let h;if(Ki(s))h=t.stepTicks(s);else if(Ki(n))h=t.forceTicks(n);else if(Ki(i))h=t.ticks(i);else{const i=t.domain(),n=t.range(),s=Q1(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=Q1(r),c=pX(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Ll(u),{x:m,y:y}=Is({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Ts).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=A3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}return d3(h,e)},A3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&u3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},k3=(t,e)=>{if(Nl(t.type))return((t,e)=>{if(!Nl(t.type))return d3(t.domain(),e);const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=Ki(s)?t.stepTicks(s):Ki(n)?t.forceTicks(n):t.ticks(i??5),"cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType){const{labelGap:i=4,labelFlush:n}=e;let s=m3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&f3(s,i);)s=x3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),Tn(a)!==Tn(r)&&a.push(Tn(r))),r=a}return d3(r,e)})(t,e);if(Wl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(Ki(s))l=t.stepTicks(s);else if(Ki(n))l=t.forceTicks(n);else if(Ki(i))l=t.ticks(i);else{const i=t.domain(),n=t.range(),s=m3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=S3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}return d3(l,e)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return w3(t,e)}return d3(t.domain(),e)};class M3 extends F2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),Ki(this._spec.id)&&t.setUserId(this._spec.id),Yi(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==pn(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=DZ(BZ.axis(),{appear:this._spec.animationAppear??pn(this._option.getChart().getSpec(),"animationAppear.axis")??pn(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??pn(this._option.getChart().getSpec(),"animationDisappear.axis")??pn(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??pn(this._option.getChart().getSpec(),"animationEnter.axis")??pn(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??pn(this._option.getChart().getSpec(),"animationExit.axis")??pn(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??pn(this._option.getChart().getSpec(),"animationUpdate.axis")??pn(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return zl(this._regions,(e=>{en(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;Ki(t)&&(this._seriesUserId=Cn(t)),Ki(i)&&(this._regionUserId=Cn(i)),Ki(e)&&(this._seriesIndex=Cn(e)),Ki(n)&&(this._regionIndex=Cn(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(zl(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!Nl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(zl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return en(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===JU.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&Xi(t.title.angle)&&(i="left"===t.orient?-90:90,e=J1[t.orient]),{select:t.select,hover:t.hover,line:(n=t.domainLine,bX(n),bX(n.startSymbol),bX(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:$i(t.label.style)?(e,i)=>{const n=this._preprocessSpec(t.label.style(e.rawValue,i,e));return SX(this._preprocessSpec(xn({},this._theme.label?.style,n)))}:SX(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:xX(t.label.state)},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:$i(t.tick.style)?(e,i)=>{const n=this._preprocessSpec(t.tick.style(e.rawValue,i,e));return SX(this._preprocessSpec(xn({},this._theme.tick?.style,n)))}:SX(t.tick.style),state:xX(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:SX(t.subTick.style),state:xX(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:$i(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return SX(this._preprocessSpec(xn({},this._theme.grid?.style,n)))}:SX(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:SX(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Es(i):null,textStyle:xn({},e,SX(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:SX(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:SX(t.title.background?.style)},state:{text:xX(t.title.state),shape:xX(t.title.shape?.state),background:xX(t.title.background?.state)}},panel:{visible:t.background?.visible,style:SX(t.background?.style),state:xX(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const C3=[v3.AxisLabelOverlapPlugin,v3.AxisSyncPlugin];class T3 extends M3{static type=n.cartesianAxis;type=n.cartesianAxis;name=n.cartesianAxis;layoutType="region-relative";layoutZIndex=J$.Axis;layoutLevel=Q$.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;constructor(t,e){super(t,{...e}),this._orient=LX(t,["z"]),DX(this._orient)&&(this.layoutType="absolute"),Ki(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?BX(t)?"linear":"band":BX(t)?"band":"linear"}(t.orient,i),s=`${T3.type}-${n}`,r=AX.getComponentInKey(s);if(r){let n=t.inverse;return i&&!BX(t.orient)&&(n=!Ki(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(T3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[T3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===$h.horizontal;if(!en(i))return e2(i)?T3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>IX(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{e2(t)&&a.push(T3.createAxis(t,{...e,specIndex:i,specKey:T3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),zl(this._regions,(t=>{BX(this.orient)?t.setXAxisHelper(this.axisHelper()):IX(this.orient)?t.setYAxisHelper(this.axisHelper()):DX(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];BX(this.orient)?an(e)&&(s=n?[e,0]:[0,e]):DX(this.orient)?an(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):an(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(C3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=BX(this.orient)?t.fieldX:DX(this.orient)?t.fieldZ:t.fieldY,Nl(this._scale.type)?e:[e[0]]}_initData(){JX(this._option.dataSet,"scale",b3),ZX(this._option.dataSet,"ticks",k3);const t=this._spec.label||{},e=this._tick||{},i=new jo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new zK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(uV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(BX(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(L$.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return zl(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return zl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:BX(this.orient)?i.fieldX:DX(this.orient)?i.fieldZ:i.fieldY,n=en(n)?Nl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){zl(this._regions,(t=>{BX(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):IX(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):DX(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;an(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),an(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=BX(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(xn({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=xn({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&Xi(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=BX(this.orient),s=t=>(n?!BX(t.orient):BX(t.orient))&&Nl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(Ki(t))a=r.find((e=>e.id===t));else if(Ki(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const E3=Math.sqrt(50),R3=Math.sqrt(10),P3=Math.sqrt(2);class B3{_extend={};setExtraAttrFromSpec(){Ki(this._spec.nice)&&(this._nice=this._spec.nice),Ki(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=t2(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),Xi(this._domain?.min)&&Xi(this._domain?.max)?this._nice&&this._scale.nice(t):Ki(this._domain?.min)&&Xi(this._domain?.max)?this._nice&&this._scale.niceMax(t):Xi(this._domain?.min)&&Ki(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];Ki(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),Ki(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(En(t)-function(t){if(t&&en(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=E3?10:s>=R3?5:s>=P3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),Xi(this._domain?.min)&&Xi(this._domain?.max)?this._scale.nice(t):Ki(this._domain?.min)&&Xi(this._domain?.max)?this._scale.niceMax(t):Xi(this._domain?.min)&&Ki(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(L$.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}Mn(L3,D3);class O3 extends I3{static type=n.cartesianTimeAxis;type=n.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),zl(this._regions,(t=>{BX(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=xn({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new jo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new zK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=No.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return en(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&en(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class F3 extends M3{static type=n.polarAxis;type=n.polarAxis;name=n.polarAxis;layoutType="absolute";layoutZIndex=J$.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=AN;get startAngle(){return this._startAngle}_endAngle=kN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${F3.type}-${i}`,s=AX.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(F3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!en(i))return i2(i)?(i.center=t.center,i.startAngle=t.startAngle??MN,i.endAngle=t.endAngle??(Ki(t.startAngle)?t.startAngle+360:CN),F3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!i2(i))return;i.center=t.center,i.startAngle=t.startAngle??MN,i.endAngle=t.endAngle??(Ki(t.startAngle)?t.startAngle+360:CN),i.outerRadius=i.radius??t.outerRadius??t.radius??TN;const o=F3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),zl(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=kl(this._spec.startAngle??MN),this._endAngle=kl(this._spec.endAngle??(Ki(this._spec.startAngle)?this._spec.startAngle+360:CN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(L$.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){JX(this._option.dataSet,"scale",b3),ZX(this._option.dataSet,"ticks",k3);const t=this._spec.label||{},e=this._spec.tick||{},i=new jo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new zK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return zl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=en(n)?Nl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){zl(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return Nl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=Cl({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:en(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=ks.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:en(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=TN,e=0;const i=this.getChart().getSpec();return zl(this.getRegions(),(n=>{const s=n;if(function(t){return[GK.rose,GK.radar,GK.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;an(n)&&(t=n),an(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(xn({},this._axisStyle,t))}}class z3 extends F3{static type=n.polarLinearAxis;type=n.polarLinearAxis;_zero=!0;_nice=!0;_scale=new xh;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}Mn(z3,B3);class H3 extends F3{static type=n.polarBandAxis;type=n.polarBandAxis;_scale=new hh;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function j3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:c,data:d,filter:u,regionId:p,regionIndex:g,seriesIndex:f,seriesId:m,padding:y,..._}=xn({},t),v=_;return i.visible&&(v.title=L2(i)),un(n.focusIconStyle)||SX(n.focusIconStyle),bX(n.shape),bX(n.label),bX(n.value),bX(n.background),qh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),qh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),qh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),v.item=n,un(s.textStyle)||SX(s.textStyle),bX(s.handler),v.pager=s,r.visible&&!un(r.style)&&(xn(v,r.style),Ki(r.padding)&&(v.padding=r.padding)),v}Mn(H3,D3);const N3=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},V3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return Ki(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class W3 extends F2{layoutType="normal";layoutZIndex=J$.Legend;layoutLevel=Q$.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{zl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),zl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Xh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;Ki(i)&&(this._seriesUserId=Cn(i)),Ki(t)&&(this._regionUserId=Cn(t)),Ki(n)&&(this._seriesIndex=Cn(n)),Ki(e)&&(this._regionUserIndex=Cn(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new zK(this._option,t),this._initSelectedData(),zl(this._regions,(t=>{t.event.on(L$.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;Xi(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(L$.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;an(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)An(n,this._cacheAttrs)||this._legendComponent.setAttributes(xn({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(xn({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class U3 extends W3{static type=n.discreteLegend;type=n.discreteLegend;name=n.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!en(i))return i.type&&"discrete"!==i.type?void 0:new U3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new U3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),zl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){ZX(this._option.dataSet,"discreteLegendFilter",V3),ZX(this._option.dataSet,"discreteLegendDataMake",N3);const t=new jo(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!el(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&Xi(t.title.text)&&Xi(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=yX(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...j3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return VG}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(FG.legendItemClick,(e=>{const i=pn(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(L$.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(FG.legendItemHover,(t=>{const e=pn(t,"detail");this.event.emit(L$.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(FG.legendItemUnHover,(t=>{const e=pn(t,"detail");this.event.emit(L$.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:an(r)?r:1,strokeOpacity:an(a)?a:1,opacity:an(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return $i(this._spec.data)?this._spec.data(t):t}}const G3=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;an(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},Y3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!un(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function $3(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:c,id:d,visible:u,orient:p,position:g,data:f,defaultSelected:m,field:y,filter:_,regionId:v,regionIndex:b,seriesIndex:x,seriesId:S,padding:w,...A}=xn({},t),k=A;return e.visible&&(k.title=L2(e)),k.showHandler=!1!==i.visible,un(i.style)||(k.handlerStyle=SX(i.style)),Ki(n.width)&&(k.railWidth=n.width),Ki(n.height)&&(k.railHeight=n.height),un(n.style)||(k.railStyle=SX(n.style)),un(s.style)||(k.trackStyle=SX(s.style)),k.startText=bX(r),k.endText=bX(a),k.handlerText=bX(o),un(l)||(k.sizeBackground=SX(l)),h.visible&&!un(h.style)&&(xn(k,h.style),Ki(h.padding)&&(k.padding=h.padding)),k}function X3(t){return"color"===t||"size"===t}const K3={color:$G,size:KG},q3=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Z3=[2,10];class J3 extends W3{static type=n.continuousLegend;type=n.colorLegend;name=n.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!en(i))return X3(i.type)?new J3(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{X3(t.type)&&n.push(new J3(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?n.colorLegend:n.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),zl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){ZX(this._option.dataSet,"continuousLegendFilter",Y3),ZX(this._option.dataSet,"continuousLegendDataMake",G3);const t=new jo(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&Xi(t.title.text)&&Xi(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=yX(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!el(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=yX(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),un(n)&&(n="color"===this._legendType?q3:Z3);const r={...$3(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return K3[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",Qn((e=>{const i=pn(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(L$.legendFilter,{model:this,value:i,event:e})}),30))}}}const Q3=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),Cn(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class t5 extends F2{static type=n.indicator;type=n.indicator;name=n.indicator;layoutType="absolute";layoutZIndex=J$.Indicator;layoutLevel=Q$.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==t5.type)return null;const i=Cn(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map((t=>new t5(t,e)));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(Cn(this._spec.regionId),Cn(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){ZX(this._option.dataSet,"indicatorFilter",Q3);const t=new jo(this._option.dataSet);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 zK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return Cn(this._spec.content).forEach((t=>{const e=xn({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{...SX(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!Ki(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{...SX(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)An(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new JG(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":$i(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return zl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){super.clear(),this._indicatorComponent=null,this._cacheAttrs=null}}class e5 extends F2{static type=n.title;type=n.title;layoutType="normal";layoutZIndex=J$.Title;layoutLevel=Q$.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Xh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!en(i))return new e5(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new e5(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;an(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),an(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:an(t.width())?t.width():0,height:this._spec.height?this._spec.height:an(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)An(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new qG(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class i5{projection;constructor(t){if(this.projection=mJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function n5(t,e){return`${Jj}_${e}_${t}`}class s5 extends F2{static type=n.geoCoordinate;type=n.geoCoordinate;name=n.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:n5(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(Xi(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new s5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=xn(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(L$.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new i5(this._projectionSpec)}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===GK.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===GK.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(GK.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==GK.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}Mn(s5,O1);const r5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},a5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class o5 extends F2{layoutType="absolute";gridZIndex=J$.CrossHair_Grid;labelZIndex=J$.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();en(t)?t.forEach(((t,i)=>this._registerEvent(t,en(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:O$.chart},this._handleEvent),this.event.on(e,{level:F$.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ts((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(r5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(en(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(r5[e][t]),s=s.concat(r5[e][i(t)])})),{in:n,out:s}}return{in:r5[e][t],out:r5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=pn(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{a5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();en(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),en(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function h5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var c5,d5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(c5||(c5={}));class u5 extends o5{static type=n.cartesianCrosshair;type=n.cartesianCrosshair;name=n.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(Xi(i))return;if(!en(i))return i.xField||i.yField?new u5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new u5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,c5.VERTICAL,!0),this.layoutByValue(c5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,c5.HORIZONTAL,!1),this.layoutByValue(c5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return Nl(t.getScale().type)&&an(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){BX(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{Wl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(c5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=c5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,c;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(Wl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(Nl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=h5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=Q1(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(Wl(s.type)){const t=s._step;c=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(Nl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=h5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(c=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):c=1,a=r}}if(this.yHair.label?.visible){const e=Q1(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&Ki(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&Ki(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(c5.HORIZONTAL&&this._layoutHorizontal(n,c??0),c5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new SU({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new wU({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new bU(e)),n.add(t)),l5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(d5||(d5={}));class p5 extends o5{static type=n.polarCrosshair;type=n.polarCrosshair;name=n.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(Xi(i))return;if(!en(i))return i.categoryField||i.valueField?new p5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new p5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{Wl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});Nl(s.getScale().type)&&an(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:ks.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(d5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",xn(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=Q1(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=Q1(t.getSpec())),n.angle=i.angle,n.axis=t,xn(n,s)}))),this.enableRemain&&!i.visible&&Ki(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&Ki(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(d5.HORIZONTAL&&this._layoutHorizontal(n),d5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:Is(l,n,i),end:Is(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new SU({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new kU({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Ll(i),e={...Is(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Ds(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=Is(t,s,p),m=Is(t,s,g),y=sr([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=Kn(ks.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new MU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new AU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=Al(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}}(i),n={...Is(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new bU(e),n.add(t),i(t)),l5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const g5=t=>SX({...t}),f5=t=>({...t,style:{...SX(t.style)}}),m5=t=>{const e=g5(t?.slider?.trackStyle??{}),i=g5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},SX({...s}));var s;const r=f5(t?.controller?.start??{}),a=f5(t?.controller?.pause??{}),o=f5(t?.controller?.backward??{}),l=f5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},y5=(t,e)=>({...m5(t),data:e,type:"continuous"}),_5=(t,e)=>({...m5(t),data:e,type:"discrete"}),v5=t=>"left"===t||"right"===t,b5=t=>"top"===t||"bottom"===t;class x5 extends F2{layoutZIndex=J$.Player;layoutLevel=Q$.Player;static type=n.player;type=n.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return Xi(i)||!1===i.visible?null:new x5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),an(t.x)){const e=v5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(an(t.y)){const e=b5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(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}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{..._5(this._spec,this._specs),...e}:{...y5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?An(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new dY(t):this._playerComponent=new pY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 rn(this._spec.width)?Math.min(t.width,Number(this._spec.width)):v5(this._orient)?this._maxSize():t.width}_computeHeight(t){return rn(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):b5(this._orient)?this._maxSize():t.height}_computeDx(t){return v5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return b5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...Cn(this._spec.controller.start?.style?.size),...Cn(this._spec.controller.pause?.style?.size),...Cn(this._spec.controller.backward?.style?.size),...Cn(this._spec.controller.forward?.style?.size),(v5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(v5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...Cn(this._spec.controller.start?.style?.size),...Cn(this._spec.controller.pause?.style?.size),...Cn(this._spec.controller.backward?.style?.size),...Cn(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(L$.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(aY.OnEnd,(()=>{this.event.emit(L$.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(aY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];Cn(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(L$.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(aY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(L$.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const S5=(t,e)=>Pl(t[0].latestData,e.field),w5=(t,e)=>Bl(t[0].latestData,e.field);function A5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return an(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function k5(t,e){return Il(t[0].latestData,e.field)}function M5(t,e){return Dl(t[0].latestData,e.field)}function C5(t,e){return function(t,e){return Math.sqrt(Dl(t,e))}(t[0].latestData,e.field)}function T5(t,e){return function(t,e){return Fn(t.map((t=>t[e])))}(t[0].latestData,e.field)}function E5(t,e){const i={min:S5,max:w5,sum:A5,average:k5,variance:M5,standardDeviation:C5,median:T5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(Ki(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(Ki(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function R5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],c=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,d=n.getXAxisHelper().getScale(0).domain();return c.forEach((t=>{if(Ki(t.x)){rn(t.x)&&I5(d,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function P5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],c=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,d=n.getYAxisHelper().getScale(0).domain();return c.forEach((t=>{if(Ki(t.y)){rn(t.y)&&I5(d,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function B5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();rn(t.x)&&I5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),rn(t.y)&&I5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function I5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const D5=["sum","average","min","max","variance","standardDeviation","median"];class L5 extends F2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||D5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??Cn(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(Cn(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Pl(t,e),r=Bl(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class F5 extends L5{static type=n.markLine;type=n.markLine;name=n.markLine;layoutZIndex=J$.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(Xi(i))return;if(!en(i)&&!1!==i.visible)return new F5(i,{...e,specKey:F5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new F5(t,{...e,specIndex:i,specKey:F5.speckey}))})),n}_createMarkerComponent(){const t=new TG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:SX(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:SX(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:SX(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...SX(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...SX(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:SX(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=Ki(t.x)||Ki(t.coordinates)&&Ki(t.process)&&Ki(t.process.x),a=Ki(t.y)||Ki(t.coordinates)&&Ki(t.process)&&Ki(t.process.y),o=Ki(t.coordinates)&&(!Ki(t.process)||"process"in t&&"xy"in t.process),l=Ki(t.positions),h=t?.autoRange??!1;let c=[];r?c=R5(e,i,n,s,h)[0]:a?c=P5(e,i,n,s,h)[0]:o?c=B5(e,s,h):l&&(c=t.positions),this._markerComponent?.setAttributes({points:c})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;ZX(this._option.dataSet,"markerAggregation",E5),ZX(this._option.dataSet,"markerRegression",O5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new jo(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new jo(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class z5 extends L5{static type=n.markArea;type=n.markArea;name=n.markArea;layoutZIndex=J$.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(Xi(i))return;if(!en(i)&&!1!==i.visible)return new z5(i,{...e,specKey:z5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new z5(t,{...e,specIndex:i,specKey:z5.speckey}))})),n}_createMarkerComponent(){const t=new EG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:SX(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...SX(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...SX(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:SX(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=Ki(t.x)&&Ki(t.x1),a=Ki(t.y)&&Ki(t.y1),o=Ki(t.coordinates),l=Ki(t.positions),h=t?.autoRange??!1;let c=[],d=[];r?(d=R5(e,i,n,s,h),c=[...d[0],d[1][1],d[1][0]]):a?(d=P5(e,i,n,s,h),c=[...d[0],d[1][1],d[1][0]]):o?c=B5(e,s,h):l&&(c=t.positions),this._markerComponent?.setAttributes({points:c})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=Ki(t.x)&&Ki(t.x1),n=Ki(t.y)&&Ki(t.y1),s=Ki(t.coordinates);if(!i&&!n&&!s)return null;let r;ZX(this._option.dataSet,"markerAggregation",E5),ZX(this._option.dataSet,"markerRegression",O5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new jo(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class H5 extends L5{static type=n.markPoint;type=n.markPoint;name=n.markPoint;layoutZIndex=J$.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(Xi(i))return;if(!en(i)&&!1!==i.visible)return new H5(i,{...e,specKey:H5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new H5(t,{...e,specIndex:i,specKey:H5.speckey}))})),n}_createMarkerComponent(){const t=new RG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:SX(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:SX(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{...SX(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{...SX(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:SX(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=B5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!Ki(t.coordinate))return;ZX(this._option.dataSet,"markerAggregation",E5);const i=this._processSpecCoo(t),n=new jo(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const j5=(t,e,i)=>Xi(t)?t:$i(t)?t(e,i):t,N5=(t,e,i)=>{if(Xi(t))return t;if(en(t)){const n=[];return t.forEach((t=>{if($i(t)){const s=t(e,i);Ki(s)&&n.push(s)}else n.push(t)})),n}return $i(t)?t(e,i):t};const V5="vchart-tooltip-container",W5=20,U5={key:"其他",value:"..."},G5={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class Y5{static dom=`${Jj}_TOOLTIP_HANDLER_DOM`;static canvas=`${Jj}_TOOLTIP_HANDLER_CANVAS`}const $5=(t,e,i)=>{const n=j5(e.key,t,i),s=j5(e.value,t,i),r=!1!==j5(e.visible,t,i)&&(Ki(n)||Ki(s)),a=j5(e.isKeyAdaptive,t,i),o=j5(e.shapeType,t,i),l=j5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},X5=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,K5=(t,e)=>{let i;if(Ki(t))if(rn(t))i=t;else if($i(t)){const n=t(e);rn(n)&&(i=n)}return i},q5=(t,e)=>{const i=pX(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function Z5(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Bj,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var J5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(J5||(J5={}));class Q5{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),J5.success):(this._updateTooltip(!1,e),J5.success)}if(Xi(n)||Xi(s))return J5.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(Ki(t.visible)||Ki(t.activeType)?s.visible=dq(t).includes("mark"):Ki(e.visible)||Ki(e.activeType)?s.visible=dq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=X5(i,"mark")??{},a=xn({},yn(e.mark),yn(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(Ki))),[]);if(t.every((t=>!dq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:Ki(e.visible)||Ki(e.activeType)?s.visible=dq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=X5(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{$i(t)?o.push(t):o.push(...Cn(t))})),r={...i[0],content:o};let l={};const h=t.filter((t=>{const e=t.tooltipHelper?.spec;return Ki(e?.dimension)&&dq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(h.length){let t=[];h.every((({content:t})=>Xi(t)))?t=void 0:h.forEach((({content:e})=>{Xi(e)||($i(e)?t?.push(e):t?.push(...Cn(e)))})),l={...h[0],content:t}}a=xn({},yn(e.dimension),l)}const o=r.title,l={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(Ki(a.title))if($i(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...l,...n}}}else a.title={...r.title,...l,...a.title};else a.title={...r.title,...l};const h=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),c=Cn(r.content);if(Ki(a.content))if($i(a.content)){const t=a.content;a.content=(e,i)=>{const n=Cn(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...h(c[0]),...t}})),n}}else{const t=Cn(a.content);t.forEach(((e,i)=>{t[i]={...h(c[0]),...e}}))}else a.content=c.map((t=>({...t,...h(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return J5.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??J5.success;const a=r[n];if(!a)return J5.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),Xi(o.title?.key)&&Xi(o.title?.value)&&!o.content?.length?J5.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??J5.success;const o=i[n];if(!o)return J5.failed;const l=this._getActualTooltipPosition(e,N5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),J5.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=rn(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ts(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...G5,offsetX:t?.x??G5.offsetX,offsetY:t?.y??G5.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=N5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=N5(t.title,e,i),s=Cn(N5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=W5}=t,o=!1!==j5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,Ki(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=j5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=$5(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...U5});break}if(!(r.content.lengthXi(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=$5(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...U5});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(Xi(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),Xi(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!Ki(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,c=this._component.getSpec(),d="canvas"===c.renderMode,u=i?.chart?.getCanvasRect(),p=u?.width??Qj,g=u?.height??tN;let f,m,y,_,v,b,x=!1;if(qi(e)){const{left:t,right:i,top:n,bottom:s}=e;f=K5(t,r),m=K5(n,r),y=K5(i,r),_=K5(s,r)}else if(Ki(e)&&"mark"===t.activeType){x=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case PX.left:f=t-a-l,m=(i+c)/2-o/2;break;case PX.right:f=n+l,m=(i+c)/2-o/2;break;case PX.top:f=(t+n)/2-a/2,m=i-o-h;break;case PX.bottom:f=(t+n)/2-a/2,m=c+h;break;case PX.inside:f=(t+n)/2-a/2,m=(i+c)/2-o/2}}}const S={width:0,height:0},w=(t=0)=>({x:t,y:t});let A=w(),k=w(),M=1,C=1;if(Ko(this._env)&&!c.confine){if(S.width=window.innerWidth,S.height=window.innerHeight,!d){const t=this._compiler.getCanvas()??this._chartContainer;k=n.getBoundingClientRect();const e=t.getBoundingClientRect();A={x:e.x-k.x,y:e.y-k.y},M=t4(t),C=t4(n)}}else S.width=p,S.height=g;const{canvasX:T,canvasY:E}=r;v=an(f)?f:an(y)?p-a-y:T+l,b=an(m)?m:an(_)?g-o-_:E+h,v*=M,b*=M,Ko(this._env)&&(v+=A.x,b+=A.y),v/=C,b/=C;const{width:R,height:P}=S;return(v+a)*C+k.x>R&&(x?v=(R-k.x)/C-a:v-=2*l+a),(b+o)*C+k.y>P&&(x?b=(P-k.y)/C-o:b-=2*h+o),v*C+k.x<0&&(v=0-k.x/C),b*C+k.y<0&&(b=0-k.y/C),{x:v,y:b}};_getTooltipBoxSize(t,e){return e&&!Xi(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:c=[]}=t;let d=0,u=n.top+n.bottom,p=0;const{visible:g=!0,value:f="",hasShape:m,shapeType:y="",shapeHollow:_,shapeColor:v}=h;if(l.title.visible=g,g){const{text:t,width:e,height:i}=q5(f,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},d=e,p=i,m&&YR[y]){const t={symbolType:y};_?t.stroke=v:t.fill=v,l.title.shape=t,d+=r.size+r.spacing,p=Math.max(r.size,p)}l.title.width=d,l.title.height=p,u+=p}if(c.length){const t=c.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){g&&(u+=i);let e=!1;const n=[],h=[],c=[];l.content=t.map(((l,d)=>{const p={height:0,spaceRow:i};let g=0;const{hasShape:f,key:m,shapeColor:y,shapeHollow:_,shapeType:v="",value:b,isKeyAdaptive:x}=l;if(Ki(m)){const{width:t,height:e,text:i}=q5(m,a);p.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},x?h.push(t):n.push(t),g=Math.max(g,e)}if(Ki(b)){const{width:t,height:e,text:i}=q5(b,o);p.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},c.push(t),g=Math.max(g,e)}if(f&&YR[v]){e=!0;const t={visible:!0,symbolType:v};_?t.stroke=y:t.fill=y,g=Math.max(r.size,g),p.shape=t}else p.shape={visible:!1};return p.height=g,u+=g,dt.offsetWidth>0?t.getBoundingClientRect().width/t.offsetWidth:t.getBoundingClientRect().height/t.offsetHeight,e4=(t,e)=>Ki(t)?en(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function i4(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=xn({},e,t),d={};return d.fontFamily=i,d.fontSize=e4(n),d.color=s,d.textAlign=r,d.lineHeight=e4(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=e4(c),d}function n4(t,e){if(!t)return;const{size:i}=xn({},e,t),n={};return n.width=e4(i),n}class s4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===s4.type}type=s4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return s4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=Xo?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(s4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const r4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},a4={boxSizing:"border-box"},o4={display:"flex",whiteSpace:"nowrap"},l4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},h4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},c4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},d4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},u4={lineHeight:"normal"};class p4 extends s4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!YR[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=YR[e].pathStr;let o="currentColor";if(!n||tn(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(qi(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class g4 extends s4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class f4 extends s4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=Dn(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=Dn(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(xn({},l4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=xn({},a?c4:h4,{height:e4(i[n].height),...t.keyColumn.item});tn(r)&&""!==r?.trim?.()||rn(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=xn({},d4,{height:e4(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=xn({},u4,{height:e4(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=tn(s)&&""!==s?.trim?.()||rn(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=tn(s)&&""!==s?.trim?.()||rn(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class m4 extends s4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new f4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new f4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new f4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(xn({},o4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class y4 extends s4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new p4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new g4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(xn({},r4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class _4 extends s4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&Ki(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new y4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new m4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(xn({},a4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class v4 extends Q5{type=Y5.dom;_tooltipContainer=Xo?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(Xo&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:c,lineWidth:d=0},padding:u,key:p,value:g,title:f,shape:m,enterable:y,spaceRow:_,transitionDuration:v}=t,b=i,x={panel:{width:e4((e?.panel?.width??0)+2*d),height:e4((e?.panel?.height??0)+2*d),paddingBottom:e4(u.bottom),paddingLeft:e4(u.left),paddingRight:e4(u.right),paddingTop:e4(u.top),borderColor:c,borderWidth:e4(d),borderRadius:e4(h),backgroundColor:b?`${b}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:y?"auto":"none",transitionDuration:v?`${v}ms`:"initial",transitionProperty:v?"transform":"initial",transitionTimingFunction:v?"ease-out":"initial"},title:i4(f),content:{},shapeColumn:{item:n4(m),width:e4(m.size),marginRight:e4(m.spacing??8)},keyColumn:{item:i4(p),width:e4(e?.keyWidth),marginRight:e4(p.spacing??26)},valueColumn:{item:i4(g),width:e4(e?.valueWidth),marginRight:e4(g.spacing??0)},spaceRow:e4(_)};if(Ki(_)){const t=_/2;[x.shapeColumn.item,x.keyColumn.item,x.valueColumn.item].forEach((e=>{e.marginTop=e4(t),e.marginBottom=e.marginTop})),x.content.marginTop=e4(-t),x.content.marginBottom=x.content.marginTop}else[x.content,x.shapeColumn.item,x.keyColumn.item,x.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return x}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class b4 extends Q5{type=Y5.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new bY({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}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?Ki(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class x4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&Ki(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??J5.success:J5.failed}class S4 extends x4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(Xi(i))return!1;if(![Y5.dom,Y5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!uq(t)&&!Xi(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...HX(r,a)??[],...WX(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(Ki(i))break}return Ki(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class w4 extends x4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(Xi(i))return!1;if(![Y5.dom,Y5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const A4=t=>Ki(t)&&!en(t),k4=t=>Ki(t)&&en(t);class M4 extends F2{static type=n.tooltip;type=n.tooltip;name=n.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!en(i))return new M4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new M4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?b4:v4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new w4(this),dimension:new S4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:F$.chart},this._handleMouseMove),(qo(e)||Zo(e))&&(this._mountEvent("pointerdown",{level:F$.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:F$.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;Ko(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||uq(t)||(n&&A4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&k4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):Ki(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!Xi(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&fK.globalConfig.uniqueTooltip&&fK.hideTooltip(a.id),r};_getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=xn({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!Ki(t.visible)||t.visible,activeType:dq(t),renderMode:"html",trigger:Ki(t.trigger)?t.trigger:"hover",className:Ki(t.className)?t.className:"vchart-tooltip-element",enterable:!!Ki(t.enterable)&&t.enterable,transitionDuration:Ki(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=Ki(t.triggerOff)?t.triggerOff:this._spec.trigger,Ki(t.renderMode)?this._spec.renderMode=t.renderMode:Zo(this._option.mode)&&(this._spec.renderMode="canvas"),Ki(t.mark)&&(this._spec.mark={...yn(t.mark),activeType:"mark"}),Ki(t.dimension)&&(this._spec.dimension={...yn(t.dimension),activeType:"dimension"}),Ki(t.parentElement)?tn(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Ko(this._option.mode)&&(this._spec.parentElement=Xo?.body),Ki(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=cq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:O$.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(Xi(this._cacheInfo)||Xi(t))return!1;if(k4(t)){if(A4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>MX(t,e[i])))}if(k4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(Ki(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(Ki(n)&&Ki(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function C4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function T4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const E4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??C4(e)};let o=!1;return tn(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??T4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class R4 extends F2{static type=n.label;type=n.label;name=n.label;layoutType="absolute";layoutZIndex=J$.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new R4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(L$.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(uV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(uV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),zl(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:wX.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:wX.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=E4[s.type]??E4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return xn({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class P4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(an(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:$i(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&Ki(t.modelId)){if(Ki(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&Ki(t.modelKey)&&"modelIndex"in t&&Ki(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>B4(t))),a=s.filter((t=>!B4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>B4(t))),h=o.filter((t=>!B4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);an(o.width)||(o.width=a.width),an(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function B4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class I4 extends DK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&BX(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&IX(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}fK.useChart([W1,u2,U1,G1,M2,p2,f2,m2,A2,b2,X1,C2,c2,d2,y2,B2,I2,q1,Z1,_2,S2,w2,T2,$1,E2,R2,Y1,k2,o2,x2,l2]),fK.useComponent([I3,L3,O3,H3,z3,U3,J3,M4,u5,p5,V2,N2,t5,s5,F5,e5,z5,x5,R4,H5,U2,W2,e3]),AX.registerLayout("grid",P4),AX.registerLayout("layout3d",I4),t.Arc3dMark=NJ,t.ArcMark=zJ,t.AreaChart=W1,t.AreaMark=cJ,t.AreaSeries=dJ,t.Bar3dChart=G1,t.Bar3dSeries=rJ,t.BarChart=U1,t.BarSeries=VZ,t.BaseChart=KK,t.BaseMark=NK,t.BaseSeries=Mq,t.BoxPlotChart=Y1,t.BoxPlotMark=KZ,t.BoxPlotSeries=JZ,t.Brush=U2,t.CartesianAxis=T3,t.CartesianBandAxis=L3,t.CartesianChart=qK,t.CartesianCrossHair=u5,t.CartesianLinearAxis=I3,t.CartesianSeries=Cq,t.CartesianTimeAxis=O3,t.CellMark=N1,t.CirclePackingChart=$1,t.CirclePackingSeries=v1,t.CircularProgressChart=y2,t.CircularProgressSeries=aQ,t.CommonChart=X1,t.ComponentMark=WK,t.ContinuousLegend=J3,t.CustomMark=W2,t.DataZoom=V2,t.DiscreteLegend=U3,t.DotSeries=eQ,t.Factory=AX,t.Funnel3dChart=Z1,t.Funnel3dSeries=B0,t.FunnelChart=q1,t.FunnelSeries=R0,t.GaugeChart=o2,t.GaugePointerSeries=z1,t.GaugeSeries=H1,t.GeoCoordinate=s5,t.GridLayout=P4,t.GroupMark=VK,t.HeatmapChart=l2,t.HeatmapSeries=V1,t.Histogram3dChart=d2,t.HistogramChart=c2,t.Indicator=t5,t.Label=R4,t.Layout=DK,t.Layout3d=I4,t.LineChart=u2,t.LineMark=iJ,t.LineSeries=nJ,t.LinearProgressChart=_2,t.LinearProgressSeries=lQ,t.LinkPathMark=P1,t.LinkSeries=nQ,t.MapChart=p2,t.MapLabelComponent=e3,t.MapSeries=PJ,t.MarkArea=z5,t.MarkLine=F5,t.MarkPoint=H5,t.PathMark=CJ,t.Pie3dChart=m2,t.Pie3dSeries=VJ,t.PieChart=f2,t.PieSeries=jJ,t.Player=x5,t.PolarAxis=F3,t.PolarBandAxis=H3,t.PolarChart=r2,t.PolarCrossHair=p5,t.PolarLinearAxis=z3,t.PolarSeries=BJ,t.PolygonMark=E0,t.ProgressArcMark=rQ,t.ProgressLikeChart=a2,t.ProgressLikeSeries=sQ,t.Pyramid3dMark=P0,t.RadarChart=b2,t.RadarSeries=ZJ,t.RangeAreaChart=x2,t.RangeAreaSeries=pJ,t.RangeColumn3dChart=w2,t.RangeColumn3dSeries=hJ,t.RangeColumnChart=S2,t.RangeColumnSeries=lJ,t.Rect3dMark=sJ,t.RectMark=jZ,t.RoseChart=A2,t.RoseLikeChart=v2,t.RoseLikeSeries=KJ,t.RoseSeries=qJ,t.RuleMark=WZ,t.SankeyChart=k2,t.SankeySeries=B1,t.ScatterChart=M2,t.ScatterSeries=XJ,t.ScrollBar=N2,t.SequenceChart=C2,t.SunburstChart=T2,t.SunburstSeries=m1,t.SymbolMark=ZZ,t.TextMark=NZ,t.ThemeManager=uX,t.Title=e5,t.Tooltip=M4,t.TreeMapChart=E2,t.TreeMapSeries=F1,t.VChart=fK,t.WaterfallChart=R2,t.WaterfallSeries=UZ,t.WordCloud3dChart=I2,t.WordCloud3dSeries=p0,t.WordCloudChart=B2,t.WordCloudSeries=u0,t.default=fK,t.version="1.1.0-beta.8",Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var s={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);sObject.prototype.toString.call(t)===`[object ${e}]`,o=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||a(t,"Boolean")},l=t=>"function"==typeof t,h=t=>null==t,c=t=>null!=t,d=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},u=t=>"object"==typeof t&&null!==t,p=function(t){if(!u(t)||!a(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},g=t=>void 0===t,f=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||a(t,"String")},m=t=>Array.isArray?Array.isArray(t):a(t,"Array"),y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},_=t=>a(t,"Date"),v=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||a(t,"Number")},b=t=>v(t)&&Number.isFinite(t),x=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),S=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),w=Object.prototype,A=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)},k=Object.prototype.hasOwnProperty;function M(t){if(h(t))return!0;if(y(t))return!t.length;const e=S(t);if("Map"===e||"Set"===e)return!t.size;if(A(t))return!Object.keys(t).length;for(const e in t)if(k.call(t,e))return!1;return!0}const C=(t,e,i)=>{const n=f(e)?e.split("."):e;for(let e=0;enull!=t&&T.call(t,e);function P(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,o){if(null===i)return null;if(0===o)return i;let l;if("object"!=typeof i)return i;if(m(i)?l=[]:a(i,"RegExp")?(l=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(l.lastIndex=i.lastIndex)):l=_(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(l)}for(const e in i)l[e]=t(i[e],o-1);return l}(t,i)}function R(t){let e;if(!c(t)||"object"!=typeof t)return t;const i=m(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:o(t)||v(t)||f(t)?t:_(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=R(n)}return e}function B(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(c(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];c(n[r])&&"object"==typeof n[r]?I(t,e,r,i):D(t,r,n[r])}}}}function I(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(m(r)){if(n)a=[];else if(m(s))a=s;else if(y(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!z(t[i],e[i]))return!1;return!0}if(!p(t))return!1;const i=F(t),n=F(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!z(t[s],e[s]))return!1}return!0}function H(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function U(t,e){if(!m(t)||!m(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Y(t,e,i){c(e)||(e=t,t=0),c(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function $(t){return Number(t)}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function q(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(h(n)&&(n=t.length);i>>1;X(t[s],e)>0?n=s:i=s+1}return i}const Z=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(X)),K(i,.5)},J=Math.sqrt(50),Q=Math.sqrt(10),et=Math.sqrt(2);function it(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=J?s*=10:r>=Q?s*=5:r>=et&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:nt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function at(t,e,i,n){return t>e&&!rt(t,e,i,n)}function ot(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},ht=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?lt(n,r)+s:"center"===i?lt(n,Math.floor(r/2))+s+lt(n,Math.ceil(r/2)):s+lt(n,r)},ct=function(t,e,i){return ti?i:t},dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,p=!0;const g=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function y(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function _(){const t=Date.now();if(y(t))return v(t);o=m(_,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function v(t){return o=void 0,p&&n?f(t):(n=s=void 0,a)}function x(){const t=Date.now(),i=y(t);for(var r=arguments.length,d=new Array(r),p=0;pt*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const _t=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vt=new RegExp(_t.source,"g");const bt=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function xt(t){if(t instanceof Date)return t;if(f(t)){const e=bt.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return h(t)?new Date(NaN):new Date(Math.round(t))}const St=1e-12,wt=Math.PI,At=wt/2,kt=2*wt,Mt=2*Math.PI,Ct=Math.abs,Tt=Math.atan2,Et=Math.cos,Pt=Math.max,Rt=Math.min,Bt=Math.sin,It=Math.sqrt,Dt=Math.pow;function Lt(t){return t>1?0:t<-1?wt:Math.acos(t)}function Ot(t){return t>=1?At:t<=-1?-At:Math.asin(t)}function Ft(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function zt(t,e){return t[0]*e[1]-t[1]*e[0]}class Ht{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ht(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return v(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return v(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class jt{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Ht((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return m(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Nt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class Wt extends Vt{}function Ut(t){return t*(Math.PI/180)}function Gt(t){return 180*t/Math.PI}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-kt;)t+=kt;else if(t>0)for(;t>kt;)t-=kt;return t},Xt=Yt;function $t(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Kt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new qt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new qt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new qt(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=Gt(r.rotateDeg),r}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return v(t)?new re(t>>16,t>>8&255,255&t,1):m(t)?new re(t[0],t[1],t[2]):new re(255,255,255)}let se=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(c(te[t]))return function(t){return v(t)?new re(t>>>24,t>>>16&255,t>>>8&255,255&t):m(t)?new re(t[0],t[1],t[2],t[3]):new re(255,255,255,1)}(te[t]);if(c(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new re((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new re(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new re(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new re(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new re(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=Zt(h(t)?s.h:ct(t,0,360),h(e)?s.s:e>=0&&e<=1?100*e:e,h(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new re(r.r,r.g,r.b,n),this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}};class re{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),c(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ae(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new re(e,c,d,l*(1-t)+h*t)}},rgbToHex:oe,rgbToHsl:Jt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ye;function _e(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}var be;function xe(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me]),ce>fe||deye||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function Ae(t){return t/180*Math.PI}function ke(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?t.angle:Ae(t.angle),n=ke(t);return[we({x:t.x1,y:t.y1},i,n),we({x:t.x2,y:t.y1},i,n),we({x:t.x2,y:t.y2},i,n),we({x:t.x1,y:t.y2},i,n)]}let Ce,Te,Ee,Pe;function Re(t){return Ce=1/0,Te=1/0,Ee=-1/0,Pe=-1/0,t.forEach((t=>{Ce>t.x&&(Ce=t.x),Eet.y&&(Te=t.y),Pee&&r>n||rs?o:0}function Oe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class ze{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),c(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=c(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(h(this._canvas)&&(c(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),h(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&c(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),h(this._context)&&c(this._canvas)){const t=this._canvas.getContext("2d");c(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!h(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(h(t))return{width:0,height:0};if(h(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let c;try{const h=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});c={width:h.width(),height:h.height()}}catch(e){this._notSupportVRender=!0,c=this.measureWithNaiveCanvas(t)}return c}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(h(this._numberCharSize)){const t=this._standardMethod(ze.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ze.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return h(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ze.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(h(this._letterCharSize)){const t=this._standardMethod(ze.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ze.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return c(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){c(this._canvas)&&(this._canvas=null),c(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}ze.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ze.NUMBERS_CHAR_SET="0123456789",ze.FULL_SIZE_CHAR="字";const He="undefined"!=typeof console;function je(t,e,i){const n=[e].concat([].slice.call(i));He&&console[t].apply(console,n)}var Ne;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(Ne||(Ne={}));class Ve{static getInstance(t,e){return Ve._instance&&v(t)?Ve._instance.level(t):Ve._instance||(Ve._instance=new Ve(t,e)),Ve._instance}static setInstance(t){return Ve._instance=t}static setInstanceLevel(t){Ve._instance?Ve._instance.level(t):Ve._instance=new Ve(t)}static clearInstance(){Ve._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ne.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Ne.Info}canLogDebug(){return this._level>=Ne.Debug}canLogError(){return this._level>=Ne.Error}canLogWarn(){return this._level>=Ne.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Ne.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):je(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Ne.Warn&&je(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Ne.Info&&je(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Ne.Debug&&je(this._method||"log","DEBUG",e),this}}function We(t){if(b(t))return[t,t,t,t];if(m(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(d(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Ue(t){return t?"getUTCFullYear":"getFullYear"}function Ge(t){return t?"getUTCMonth":"getMonth"}function Ye(t){return t?"getUTCDate":"getDate"}function Xe(t){return t?"getUTCHours":"getHours"}function $e(t){return t?"getUTCMinutes":"getMinutes"}function Ke(t){return t?"getUTCSeconds":"getSeconds"}function qe(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Ze(t){return t?"setUTCFullYear":"setFullYear"}Ve._instance=null;const Je=1e3,Qe=6e4,ti=36e5,ei=24*ti,ii=31*ei,ni=365*ei,si=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),ri=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),ai=(t,e)=>e.getFullYear()-t.getFullYear(),oi=t=>t.getFullYear(),li=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),hi=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),ci=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),di=t=>t.getUTCFullYear(),ui=t=>(t.setDate(1),t.setHours(0,0,0,0),t),pi=(t,e)=>(t.setMonth(t.getMonth()+e),t),gi=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),fi=t=>t.getMonth(),mi=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),yi=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),_i=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),vi=t=>t.getUTCMonth(),bi=t=>(t.setHours(0,0,0,0),t),xi=(t,e)=>(t.setDate(t.getDate()+e),t),Si=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ei,wi=t=>t.getDate()-1,Ai=t=>(t.setUTCHours(0,0,0,0),t),ki=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Mi=(t,e)=>(+e-+t)/ei,Ci=t=>t.getUTCDate()-1,Ti=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),Ei=(t,e)=>(t.setHours(t.getHours()+e),t),Pi=(t,e)=>(+e-+t)/ti,Ri=t=>t.getHours(),Bi=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),Ii=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Di=t=>t.getUTCHours(),Li=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),Oi=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Fi=(t,e)=>(+e-+t)/6e4,zi=t=>t.getMinutes(),Hi=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),ji=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Ni=t=>t.getUTCMinutes(),Vi=t=>(t.setTime(+t-t.getMilliseconds()),t),Wi=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ui=(t,e)=>(+e-+t)/1e3,Gi=t=>t.getSeconds(),Yi=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),Xi=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),$i=t=>t.getUTCSeconds(),Ki=t=>t,qi=(t,e)=>(t.setTime(+t+e),t),Zi=(t,e)=>+e-+t,Ji=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},Qi=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Ji(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Ji(h,c)}};function tn(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function en(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var nn=6371008.8,sn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*nn,kilometers:6371.0088,kilometres:6371.0088,meters:nn,metres:nn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:nn/1852,radians:1,yards:6967335.223679999};function rn(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function an(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function on(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ln(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Ut(t[0]),r=Ut(t[1]),a=Ut(i),o=function(t,e){void 0===e&&(e="kilometers");var i=sn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Gt(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Gt(l)}}const hn=t=>t;var cn,dn;t.RenderModeEnum=void 0,(cn=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",cn["mobile-browser"]="mobile-browser",cn.node="node",cn.worker="worker",cn.miniApp="miniApp",cn["desktop-miniApp"]="desktop-miniApp",cn.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.customMark="customMark"}(dn||(dn={}));for(let t=0;t<256;t++)t.toString(16);const un=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};function pn(){return new gn}function gn(){this.reset()}gn.prototype={constructor:gn,reset:function(){this.s=this.t=0},add:function(t){mn(fn,t,this.t),mn(this,fn.s,this.s),this.s?this.t+=fn.t:this.s=fn.t},valueOf:function(){return this.s}};var fn=new gn;function mn(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var yn=1e-6,_n=Math.PI,vn=_n/2,bn=_n/4,xn=2*_n,Sn=180/_n,wn=_n/180,An=Math.abs,kn=Math.atan,Mn=Math.atan2,Cn=Math.cos,Tn=Math.exp,En=Math.log,Pn=Math.pow,Rn=Math.sin,Bn=Math.sign||function(t){return t>0?1:t<0?-1:0},In=Math.sqrt,Dn=Math.tan;function Ln(t){return t>1?0:t<-1?_n:Math.acos(t)}function On(t){return t>1?vn:t<-1?-vn:Math.asin(t)}function Fn(){}function zn(t,e){t&&jn.hasOwnProperty(t.type)&&jn[t.type](t,e)}var Hn={Feature:function(t,e){zn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++n_n?t+Math.round(-t/xn)*xn:t,e]}function Qn(t,e,i){return(t%=xn)?e||i?Zn(es(t),is(e,i)):es(t):e||i?is(e,i):Jn}function ts(t){return function(e,i){return[(e+=t)>_n?e-xn:e<-_n?e+xn:e,i]}}function es(t){var e=ts(t);return e.invert=ts(-t),e}function is(t,e){var i=Cn(t),n=Rn(t),s=Cn(e),r=Rn(e);function a(t,e){var a=Cn(e),o=Cn(t)*a,l=Rn(t)*a,h=Rn(e),c=h*i+o*n;return[Mn(l*s-c*r,o*i-h*n),On(c*s+l*r)]}return a.invert=function(t,e){var a=Cn(e),o=Cn(t)*a,l=Rn(t)*a,h=Rn(e),c=h*s-l*r;return[Mn(l*s+h*r,o*i+c*n),On(c*i-o*n)]},a}function ns(t,e){(e=Gn(e))[0]-=t,qn(e);var i=Ln(-e[1]);return((-e[2]<0?-i:i)+xn-yn)%xn}function ss(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:Fn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function rs(t,e){return An(t[0]-e[0])=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function ls(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function us(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function ps(t,e,i,n){return function(s){var r,a,o,l=e(s),h=ss(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=y,u.lineStart=_,u.lineEnd=v,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=us(a);var t=function(t,e){var i=cs(e),n=e[1],s=Rn(n),r=[Rn(i),-Cn(i),0],a=0,o=0;hs.reset(),1===s?n=vn+yn:-1===s&&(n=-vn-yn);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>_n,C=f*x;if(hs.add(Mn(C*A*Rn(k),m*S+C*Cn(k))),a+=M?w+A*xn:w,M^p>=i^v>=i){var T=Xn(Gn(u),Gn(_));qn(T);var E=Xn(r,T);qn(E);var P=(M^w>=0?-1:1)*On(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-yn||a0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(gs))}return u}}function gs(t){return t.length>1}function fs(t,e){return((t=t.x)[0]<0?t[1]-vn-yn:vn-t[1])-((e=e.x)[0]<0?e[1]-vn-yn:vn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return ds(e(t),i)})}(ds);var ms=ps((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?_n:-_n,l=An(r-i);An(l-_n)0?vn:-vn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=_n&&(An(i-s)yn?kn((Rn(e)*(r=Cn(n))*Rn(i)-Rn(n)*(s=Cn(e))*Rn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*vn,n.point(-_n,s),n.point(0,s),n.point(_n,s),n.point(_n,0),n.point(_n,-s),n.point(0,-s),n.point(-_n,-s),n.point(-_n,0),n.point(-_n,s);else if(An(t[0]-e[0])>yn){var r=t[0]0,s=An(e)>yn;function r(t,i){return Cn(t)*Cn(i)>e}function a(t,i,n){var s=[1,0,0],r=Xn(Gn(t),Gn(i)),a=Yn(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=Xn(s,r),u=Kn(s,h);$n(u,Kn(r,c));var p=d,g=Yn(u,p),f=Yn(p,p),m=g*g-f*(Yn(u,u)-1);if(!(m<0)){var y=In(m),_=Kn(p,(-g-y)/f);if($n(_,u),_=Un(_),!n)return _;var v,b=t[0],x=i[0],S=t[1],w=i[1];x0^_[1]<(An(_[0]-b)_n^(b<=_[0]&&_[0]<=x)){var M=Kn(p,(-g+y)/f);return $n(M,u),[_,Un(M)]}}}function o(e,i){var s=n?t:_n-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return ps(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],f=r(d,u),m=n?f?0:o(d,u):f?o(d+(d<0?_n:-_n),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||rs(e,p)||rs(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(s&&e&&n^f){var y;m&i||!(y=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!f||e&&rs(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Cn(e),o=Rn(e),l=n*i;null==s?(s=e+n*xn,r=e-l/2):(s=ns(a,s),r=ns(a,r),(n>0?sr)&&(s+=n*xn));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return An(n[0]-t)0?0:3:An(n[0]-i)0?2:1:An(n[1]-e)0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,y,_,v=a,b=ss(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);y=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,s=(l=us(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&os(l,o,e,r,a),a.polygonEnd());v=a,l=h=c=null}};function S(t,e){s(t,e)&&v.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),y)d=r,u=a,p=o,y=!1,o&&(v.lineStart(),v.point(r,a));else if(o&&m)v.point(r,a);else{var l=[g=Math.max(vs,Math.min(_s,g)),f=Math.max(vs,Math.min(_s,f))],b=[r=Math.max(vs,Math.min(_s,r)),a=Math.max(vs,Math.min(_s,a))];!function(t,e,i,n,s,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=s-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,n)?o&&(v.lineStart(),v.point(r,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),o||v.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function xs(t){return t}var Ss,ws,As,ks,Ms=pn(),Cs=pn(),Ts={point:Fn,lineStart:Fn,lineEnd:Fn,polygonStart:function(){Ts.lineStart=Es,Ts.lineEnd=Bs},polygonEnd:function(){Ts.lineStart=Ts.lineEnd=Ts.point=Fn,Ms.add(An(Cs)),Cs.reset()},result:function(){var t=Ms/2;return Ms.reset(),t}};function Es(){Ts.point=Ps}function Ps(t,e){Ts.point=Rs,Ss=As=t,ws=ks=e}function Rs(t,e){Cs.add(ks*t-As*e),As=t,ks=e}function Bs(){Rs(Ss,ws)}var Is=Ts,Ds=1/0,Ls=Ds,Os=-Ds,Fs=Os,zs={point:function(t,e){tOs&&(Os=t);eFs&&(Fs=e)},lineStart:Fn,lineEnd:Fn,polygonStart:Fn,polygonEnd:Fn,result:function(){var t=[[Ds,Ls],[Os,Fs]];return Os=Fs=-(Ls=Ds=1/0),t}};var Hs,js,Ns,Vs,Ws=zs,Us=0,Gs=0,Ys=0,Xs=0,$s=0,Ks=0,qs=0,Zs=0,Js=0,Qs={point:tr,lineStart:er,lineEnd:sr,polygonStart:function(){Qs.lineStart=rr,Qs.lineEnd=ar},polygonEnd:function(){Qs.point=tr,Qs.lineStart=er,Qs.lineEnd=sr},result:function(){var t=Js?[qs/Js,Zs/Js]:Ks?[Xs/Ks,$s/Ks]:Ys?[Us/Ys,Gs/Ys]:[NaN,NaN];return Us=Gs=Ys=Xs=$s=Ks=qs=Zs=Js=0,t}};function tr(t,e){Us+=t,Gs+=e,++Ys}function er(){Qs.point=ir}function ir(t,e){Qs.point=nr,tr(Ns=t,Vs=e)}function nr(t,e){var i=t-Ns,n=e-Vs,s=In(i*i+n*n);Xs+=s*(Ns+t)/2,$s+=s*(Vs+e)/2,Ks+=s,tr(Ns=t,Vs=e)}function sr(){Qs.point=tr}function rr(){Qs.point=or}function ar(){lr(Hs,js)}function or(t,e){Qs.point=lr,tr(Hs=Ns=t,js=Vs=e)}function lr(t,e){var i=t-Ns,n=e-Vs,s=In(i*i+n*n);Xs+=s*(Ns+t)/2,$s+=s*(Vs+e)/2,Ks+=s,qs+=(s=Vs*t-Ns*e)*(Ns+t),Zs+=s*(Vs+e),Js+=3*s,tr(Ns=t,Vs=e)}var hr=Qs;function cr(t){this._context=t}cr.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,xn)}},result:Fn};var dr,ur,pr,gr,fr,mr=pn(),yr={point:Fn,lineStart:function(){yr.point=_r},lineEnd:function(){dr&&vr(ur,pr),yr.point=Fn},polygonStart:function(){dr=!0},polygonEnd:function(){dr=null},result:function(){var t=+mr;return mr.reset(),t}};function _r(t,e){yr.point=vr,ur=gr=t,pr=fr=e}function vr(t,e){gr-=t,fr-=e,mr.add(In(gr*gr+fr*fr)),gr=t,fr=e}var br=yr;function xr(){this._string=[]}function Sr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function wr(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Wn(t,i(n))),n.result()}return r.area=function(t){return Wn(t,i(Is)),Is.result()},r.measure=function(t){return Wn(t,i(br)),br.result()},r.bounds=function(t){return Wn(t,i(Ws)),Ws.result()},r.centroid=function(t){return Wn(t,i(hr)),hr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new xr):new cr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function Ar(t){return function(e){var i=new kr;for(var n in t)i[n]=t[n];return i.stream=e,i}}function kr(){}function Mr(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Wn(i,t.stream(Ws)),e(Ws.result()),null!=n&&t.clipExtent(n),t}function Cr(t,e,i){return Mr(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Tr(t,e,i){return Cr(t,[[0,0],e],i)}function Er(t,e,i){return Mr(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Pr(t,e,i){return Mr(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}xr.prototype={_radius:4.5,_circle:Sr(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Sr(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},kr.prototype={constructor:kr,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Rr=16,Br=Cn(30*wn);function Ir(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,m){var y=h-n,_=c-s,v=y*y+_*_;if(v>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=In(b*b+x*x+S*S),A=On(S/=w),k=An(An(S)-1)e||An((y*E+_*P)/v-.5)>.3||a*u+o*p+l*g2?t[2]%360*wn:0,E()):[m*Sn,y*Sn,_*Sn]},C.angle=function(t){return arguments.length?(v=t%360*wn,E()):v*Sn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Ir(o,M=t*t),P()):In(M)},C.fitExtent=function(t,e){return Cr(C,t,e)},C.fitSize=function(t,e){return Tr(C,t,e)},C.fitWidth=function(t,e){return Er(C,t,e)},C.fitHeight=function(t,e){return Pr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function Hr(t){var e=0,i=_n/3,n=zr(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*wn,i=t[1]*wn):[e*Sn,i*Sn]},s}function jr(t,e){var i=Rn(t),n=(i+Rn(e))/2;if(An(n)2?t[2]*wn:0),e.invert=function(e){return(e=t.invert(e[0]*wn,e[1]*wn))[0]*=Sn,e[1]*=Sn,e},e}(s.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Xr?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function qr(t){return Dn((vn+t)/2)}function Zr(t,e){var i=Cn(t),n=t===e?Rn(t):En(i/Cn(e))/En(qr(e)/qr(t)),s=i*Pn(qr(t),n)/n;if(!n)return Xr;function r(t,e){s>0?e<-vn+yn&&(e=-vn+yn):e>vn-yn&&(e=vn-yn);var i=s/Pn(qr(e),n);return[i*Rn(n*t),s-i*Cn(n*t)]}return r.invert=function(t,e){var i=s-e,r=Bn(n)*In(t*t+i*i),a=Mn(t,An(i))*Bn(i);return i*n<0&&(a-=_n*Bn(t)*Bn(i)),[a/n,2*kn(Pn(s/r,1/n))-vn]},r}function Jr(t,e){return[t,e]}function Qr(t,e){var i=Cn(t),n=t===e?Rn(t):(i-Cn(e))/(e-t),s=i/n+t;if(An(n)yn&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},la.invert=Ur(On),ha.invert=Ur((function(t){return 2*kn(t)})),ca.invert=function(t,e){return[-e,2*kn(Tn(t))-vn]},$r().translate([0,0]).center([0,0]).scale(63781);var da=Object.prototype.hasOwnProperty;function ua(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^ma[2]^ma[3])}function _a(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=ua(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return ya(r[t])}function S(t,e){return pa(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=xa(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ba(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Ia(t,e)}))}:Ia(t,e)}function Ia(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=Da(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function Da(t,e){var i=Pa(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function za(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Ra(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=Ha(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=Ga(t.slice(0,n),e),o=Ga(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Ya=Ga;!function(t){var e=Ya;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=$a(Za,e),{tolerance:n}=i;return Xa(t,n)};var Qa;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Qa||(Qa={}));const to=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},eo=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+ao(e,6):ao(e,4))+"-"+ao(t.getUTCMonth()+1,2)+"-"+ao(t.getUTCDate(),2)+(r?"T"+ao(i,2)+":"+ao(n,2)+":"+ao(s,2)+"."+ao(r,3)+"Z":s?"T"+ao(i,2)+":"+ao(n,2)+":"+ao(s,2)+"Z":n||i?"T"+ao(i,2)+":"+ao(n,2)+"Z":"")}function lo(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return no;if(h)return h=!1,io;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Qa.DSV;const i=$a(uo,e),{delimiter:n}=i;if(!f(n))throw new TypeError("Invalid delimiter: must be a string!");return lo(n).parse(t)},go=function(t){return(arguments.length>2?arguments[2]:void 0).type=Qa.DSV,ho(t)},fo=function(t){return(arguments.length>2?arguments[2]:void 0).type=Qa.DSV,co(t)};function mo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return yo(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return yo(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return vo(t);default:throw new Error("unknown GeoJSON type")}}function yo(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=_o(t.properties),e.geometry=vo(t.geometry),e}function _o(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=_o(n):e[i]=n})),e):e}function vo(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return vo(t)})),e):(e.coordinates=bo(t.coordinates),e)}function bo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return bo(t)}))}function xo(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function So(t){for(var e,i,n=xo(t),s=0,r=1;r0}function wo(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=mo(t));var r=[];switch(t.type){case"GeometryCollection":return Ao(t,(function(t){Mo(t,n)})),t;case"FeatureCollection":return wo(t,(function(t){wo(Mo(t,n),(function(t){r.push(t)}))})),an(r)}return Mo(t,n)}function Mo(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Ao(t,(function(t){Mo(t,e)})),t;case"LineString":return Co(xo(t),e),t;case"Polygon":return To(xo(t),e),t;case"MultiLineString":return xo(t).forEach((function(t){Co(t,e)})),t;case"MultiPolygon":return xo(t).forEach((function(t){To(t,e)})),t;case"Point":case"MultiPoint":return t}}function Co(t,e){So(t)===e&&t.reverse()}function To(t,e){So(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Eo(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Io=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Qa.GEO;const i=$a(Ro,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Bo(t))})):e.push(Bo(t))})),e})(t);let o=t.features;return a&&(o=ko(t,{reverse:!d(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Po.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Po.bounds(t);t.bbox=e}})),t.features=o,t},Do={},Lo=(t,e,i)=>{i.type=Qa.GEO;const n=$a(Ro,Do,e),{object:s}=n;if(!f(s))throw new TypeError("Invalid object: must be a string!");const r=Ba(t,t.objects[s]);return Io(r,n,i)},Oo=(t,e,i)=>{const n=!o(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!m(t))throw new TypeError("Invalid data: must be DataView array!");return m(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Fo=0;function zo(){return Fo>1e8&&(Fo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+Fo++}class Ho{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new r,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:zo("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){this.transformMap[t]&&console.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const jo="_data-view-diff-rank";class No{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new r,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:zo("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",eo),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=R(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[jo]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[jo]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[jo][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear};utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear};parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1};parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1};parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1};parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1};parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1};parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1};parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1};parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1};parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Wo(t,e){const i=new Set(N(t)),n=new Set(N(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Uo}=le,Go=(t,e)=>(l(Xo.warnHandler)&&Xo.warnHandler.call(null,t,e),e?Ve.getInstance().warn(`[VChart warn]: ${t}`,e):Ve.getInstance().warn(`[VChart warn]: ${t}`)),Yo=(t,e,i)=>{const n=new Error(t);return Ve.getInstance().error(`[VChart error]: ${n}`,e)},Xo={silent:!1,warnHandler:!1,errorHandler:!1},$o="undefined"!=typeof window&&void 0!==window.document,Ko=$o&&globalThis.document;function qo(t){return("desktop-browser"===t||"mobile-browser"===t)&&$o}function Zo(t){return"miniApp"===t||"mobile-browser"===t}function Jo(t){return t.includes("miniApp")||"lynx"===t}let Qo=0;function tl(){return Qo>=9999999&&(Qo=0),Qo++}function el(t){return!h(t)&&(!!v(t)||+t==+t)}function il(t){return!(!t||0===t.length)&&(!h(t[0])&&!h(t[0].dataId)&&m(t[0].fields))}const nl=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const sl=t=>e=>C(e,t),rl=t=>{Ve.getInstance().error(t)},al=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||rl("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&rl("Access path missing closing bracket: "+t),a&&rl("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return nl((i&&i.get||sl)(n),[s],e||s)},ol=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m(t)){const n=t.map((t=>al(t,e,i)));return t=>n.map((e=>e(t)))}return al(t,e,i)};ol("id");const ll=nl((function(t){return t}),[],"identity"),hl=nl((function(){return 0}),[],"zero");nl((function(){return 1}),[],"one"),nl((function(){return!0}),[],"true"),nl((function(){return!1}),[],"false"),nl((function(){return{}}),[],"emptyObject");const cl=(t,e)=>{if((te||h(e))&&!h(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},dl=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>cl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=N(e)||[],s=[],r=[],a={},o=i.comparator||dl;return N(t).forEach(((t,e)=>{if(h(t))return;s.push("desc"===n[e]?-1:1);const o=l(t)?t:ol(t,null,i);var c;r.push(o),(c=o,(h(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:nl(o(r,s),Object.keys(a))},pl=(t,e)=>{const i=l(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(h(e)||h(i))return h(e)&&h(i);if(!u(e)&&!u(i))return e===i;const s=m(e)?e:e[t],r=m(i)?i:i[t];return s===r||!1!==n&&(m(r)?!(!m(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!d(r)&&!(!d(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>gl(t,r,s)))))},fl=(t,e)=>h(t)?e:Math.min(f(t)?e*parseFloat(t)/100:t,e);function ml(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!h(s)&&(s=+s)>=s&&!h(r)&&(r=+r)>=r&&n(s,r,++a)}))}function yl(t,e,i,n,s){let r=0,a=0;return ml(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function _l(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;ml(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:yl(t,e,i,s,h)}}const vl=rt;function bl(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const xl=t=>b(t)?Ut(t):null,Sl=t=>b(t)?Gt(t):null;function wl(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Al(t,e,i,n){const s=wl({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function kl(t){return 3===t||4===t}function Ml(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}function Cl(t,e){const i=e?+t[0][e]:+t[0];if(!b(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&n{const n=e?+i[e]:+i;return b(n)&&n>t&&(t=n),t}),i)}function El(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;b(s)&&(i+=s,n++)}));return i/n}function Pl(t,e){const i=El(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Rl(t){let e="center",i="middle";return e=(t=bl(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}}function Bl(t,e){const i=Il(t),n=Il(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function Il(t,e={x:0,y:0}){return jt.distancePP(t,e)}function Dl(t,e,i){let n=!1;if(e&&l(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function Ll(t){return function(e){let i;return i=m(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var Ol;function Fl(t){switch(t){case Ol.Linear:case Ol.Log:case Ol.Pow:case Ol.Sqrt:case Ol.Symlog:case Ol.Time:return!0;default:return!1}}function zl(t){switch(t){case Ol.Linear:case Ol.Log:case Ol.Pow:case Ol.Sqrt:case Ol.Symlog:case Ol.Time:case Ol.Ordinal:case Ol.Point:case Ol.Band:return!0;default:return!1}}function Hl(t){switch(t){case Ol.Ordinal:case Ol.Point:case Ol.Band:return!0;default:return!1}}!function(t){t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(Ol||(Ol={}));class jl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Nl=Symbol("implicit");class Vl extends jl{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Ol.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Nl}clone(){return(new Vl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!h(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==Nl)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Gl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),Yl=t=>t<0?-t*t:t*t,Xl=t=>-Math.log(-t),$l=t=>-Math.exp(-t),Kl=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ql=t=>10===t?Kl:t===Math.E?Math.exp:e=>Math.pow(t,e),Zl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Jl=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Ql=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function th(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function eh(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function ih(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class rh extends Vl{constructor(t){super(),this.type=Ol.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Y(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[$(t[0]),$(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[$(t[0]),$(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:sh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return sh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}clone(){return new rh(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:ah}=le;function oh(t,e){const i=typeof e;let n;if(h(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=se.parseColorString(e)){const e=ah(se.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof re?ah(t,e):e instanceof se?ah(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class lh extends jl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Wl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Wl,this._piecewise=eh,this._interpolate=oh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,$);return this._domain=i,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=yt,this.rescale(e)}rescale(t){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=ut(this._domain[0],this._domain[n-1])),this._piecewise=n>2?ih:eh,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Wl),this.rescale(i)):this._clamp!==Wl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const hh=Math.sqrt(50),ch=Math.sqrt(10),dh=Math.sqrt(2);function uh(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=hh?a=10:r>=ch?a=5:r>=dh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function gh(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=ph(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class yh extends lh{constructor(){super(...arguments),this.type=Ol.Linear}clone(){return(new yh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return uh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return gh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=mh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=mh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=mh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function _h(t){return e=>-t(-e)}class vh extends lh{constructor(){super(Zl(10),ql(10)),this.type=Ol.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new vh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){if(t)return this;super.rescale();const e=Zl(this._base),i=ql(this._base);return this._domain[0]<0?(this._logs=_h(e),this._pows=_h(i),this.transformer=Xl,this.untransformer=$l):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Wl}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.lengththis._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}}class bh extends rh{constructor(t){super(!1),this.type=Ol.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class xh extends yh{constructor(){super(),this.type=Ol.Pow,this._exponent=1}clone(){return(new xh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=Wl,this.untransformer=Wl):.5===this._exponent?(this.transformer=Gl,this.untransformer=Yl):(this.transformer=Ul(this._exponent),this.untransformer=Ul(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function Sh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class wh{constructor(){this.type=Ol.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return Sh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new Ah).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return uh(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return gh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return fh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=mh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=mh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=mh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class kh extends yh{constructor(){super(Gl,Yl),this.type=Ol.Sqrt}clone(){return(new kh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Mh extends yh{constructor(){super(Jl(1),Ql(1)),this.type=Ol.Symlog,this._const=1}clone(){return(new Mh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=Jl(t),this.untransformer=Ql(t),this.rescale(e)):this._const}}class Ch{constructor(){this.type=Ol.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!h(t)&&b(+t)?this._range[q(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new Ch).domain(this._domain).range(this._range).unknown(this._unknown)}}const Th=[["second",1,Je],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,Qe],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,ti],["hour",3,3*ti],["hour",6,6*ti],["hour",12,12*ti],["day",1,ei],["day",2,2*ei],["day",7,7*ei],["month",1,ii],["month",3,3*ii],["month",6,6*ii],["year",1,365*ei]];function Eh(t){return+xt(t)}function Ph(t,e,i,n){const s=(+e-+t)/i,r=q(Th.map((t=>t[2])),s);if(r===Th.length){const s=Math.max(it(+t/ni,+e/ni,i),1),r=t=>(t[Ze(n)](Math.floor(t[Ue(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Ze(n)](t[Ue(n)]()+e*s),t);return{floor:r,offset:a,ceil:Ji(r,a)}}if(0===r){const n=Math.max(it(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Ji(s,r)}}const[a,o]=Th[s/Th[r-1][2]"year"===t&&e?{floor:li,offset:hi,count:ci,field:di}:"month"===t&&e?{floor:mi,offset:yi,count:_i,field:vi}:"day"===t&&e?{floor:Ai,offset:ki,count:Mi,field:Ci}:"hour"===t&&e?{floor:Bi,offset:Ii,count:Pi,field:Di}:"minute"===t&&e?{floor:Hi,offset:ji,count:Fi,field:Ni}:"second"===t&&e?{floor:Yi,offset:Xi,count:Ui,field:$i}:"year"===t?{floor:si,offset:ri,count:ai,field:oi}:"month"===t?{floor:ui,offset:pi,count:gi,field:fi}:"day"===t?{floor:bi,offset:xi,count:Si,field:wi}:"hour"===t?{floor:Ti,offset:Ei,count:Pi,field:Ri}:"minute"===t?{floor:Li,offset:Oi,count:Fi,field:zi}:"second"===t?{floor:Vi,offset:Wi,count:Ui,field:Gi}:{floor:Ki,offset:qi,count:Zi})(a,n);return Qi(o,l)}class Rh extends lh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=Ol.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(xt);const i=Array.from(t,Eh);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=xt(t),s=e[Ue(n)](),r=e[Ge(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Ye(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[Xe(n)](),c=(h-1)%12+1,d=e[$e(n)](),u=e[Ke(n)](),p=e[qe(n)]();return(i||"").replace(/YYYY/g,ht(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,ht(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,ht(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,ht(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,ht(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,ht(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,ht(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,ht(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Rh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(v(t)||h(t))&&(i=Ph(e[0],e[e.length-1],h(t)?10:t,this._isUtc)),i&&this.domain(nh(e,i)),this}utc(){return this._isUtc}}function Bh(t,e){const i=c(e)?t?.[e]??t?.default:t?.default;if(!i||m(i))return i;if(d(i)){const{dataScheme:n}=i;return n?Fh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>Oh(i)?Dh(t,i,e):i)).filter(c)}))):n.map((i=>Oh(i)?Dh(t,i,e):i)).filter(c):[]}return[]}function Ih(t,e){return Fh(t)?t.find((t=>c(t.isAvailable)?l(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!c(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function Dh(t,e,i){const n=c(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!c(e.a)&&!c(e.l)||!f(s))return s;let r=new Uo(s);if(c(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Jt(t,i,n),o=Zt(s,a,e.l),l=new Uo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return c(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Lh=(t,e,i)=>{if(Oh(t)&&e){const n=Dh(e,t,i);if(n)return n}return t};function Oh(t){return d(t)&&"palette"===t.type&&!!t.key}function Fh(t){return!!m(t)&&t.every((t=>c(t.scheme)))}class zh extends Vl{_range;range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Fh(this._range))return void super.range(this._range);const t=Ih(this._range,this._domain);super.range(t)}}const Hh={linear:yh,band:rh,point:bh,ordinal:Vl,threshold:Ch,colorOrdinal:zh};function jh(t){const e=Hh[t];return e?new e:null}function Nh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Vh(t){return c(t?.field)&&c(t?.scale)}var Wh;function Uh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Gh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Yh(t){return!!f(t)&&(!!t.endsWith("%")&&el(t.substring(0,t.length-1)))}function Xh(t,e,i){return v(t)?t:Yh(t)?Number(t.substring(0,t.length-1))*e/100:l(t)?t(i):0}function $h(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>v(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=Xh(t[s],e.size,i)}))})),n}function Kh(t){let e={};return m(t)?(h(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),h(t[1])||(e.left=e.right=t[1]),h(t[2])||(e.bottom=t[2]),h(t[3])||(e.left=t[3]),e):v(t)||Yh(t)||l(t)?(e.top=e.left=e.bottom=e.right=t,e):(d(t)&&(e={...t}),e)}function qh(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function Zh(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=Zh(t[n],e)}return i}return m(t)?t.map((t=>Zh(t,e))):t}function Jh(t){const e=t;let i;if(!c(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof No||e.every((t=>i.includes(t)))}(e))return e;const n=m(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:o(e)||v(e)||f(e)?e:_(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=Jh(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(Wh||(Wh={}));var Qh=function(t){return t&&t.Math==Math&&t},tc=Qh("object"==typeof globalThis&&globalThis)||Qh("object"==typeof window&&window)||Qh("object"==typeof self&&self)||Qh("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),ec={},ic=function(t){try{return!!t()}catch(t){return!0}},nc=!ic((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),sc=!ic((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),rc=sc,ac=Function.prototype.call,oc=rc?ac.bind(ac):function(){return ac.apply(ac,arguments)},lc={},hc={}.propertyIsEnumerable,cc=Object.getOwnPropertyDescriptor,dc=cc&&!hc.call({1:2},1);lc.f=dc?function(t){var e=cc(this,t);return!!e&&e.enumerable}:hc;var uc,pc,gc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},fc=sc,mc=Function.prototype,yc=mc.call,_c=fc&&mc.bind.bind(yc,yc),vc=fc?_c:function(t){return function(){return yc.apply(t,arguments)}},bc=vc,xc=bc({}.toString),Sc=bc("".slice),wc=function(t){return Sc(xc(t),8,-1)},Ac=ic,kc=wc,Mc=Object,Cc=vc("".split),Tc=Ac((function(){return!Mc("z").propertyIsEnumerable(0)}))?function(t){return"String"==kc(t)?Cc(t,""):Mc(t)}:Mc,Ec=function(t){return null==t},Pc=Ec,Rc=TypeError,Bc=function(t){if(Pc(t))throw Rc("Can't call method on "+t);return t},Ic=Tc,Dc=Bc,Lc=function(t){return Ic(Dc(t))},Oc="object"==typeof document&&document.all,Fc={all:Oc,IS_HTMLDDA:void 0===Oc&&void 0!==Oc},zc=Fc.all,Hc=Fc.IS_HTMLDDA?function(t){return"function"==typeof t||t===zc}:function(t){return"function"==typeof t},jc=Hc,Nc=Fc.all,Vc=Fc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:jc(t)||t===Nc}:function(t){return"object"==typeof t?null!==t:jc(t)},Wc=tc,Uc=Hc,Gc=function(t,e){return arguments.length<2?(i=Wc[t],Uc(i)?i:void 0):Wc[t]&&Wc[t][e];var i},Yc=vc({}.isPrototypeOf),Xc=tc,$c="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Kc=Xc.process,qc=Xc.Deno,Zc=Kc&&Kc.versions||qc&&qc.version,Jc=Zc&&Zc.v8;Jc&&(pc=(uc=Jc.split("."))[0]>0&&uc[0]<4?1:+(uc[0]+uc[1])),!pc&&$c&&(!(uc=$c.match(/Edge\/(\d+)/))||uc[1]>=74)&&(uc=$c.match(/Chrome\/(\d+)/))&&(pc=+uc[1]);var Qc=pc,td=ic,ed=tc.String,id=!!Object.getOwnPropertySymbols&&!td((function(){var t=Symbol();return!ed(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Qc&&Qc<41})),nd=id&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,sd=Gc,rd=Hc,ad=Yc,od=Object,ld=nd?function(t){return"symbol"==typeof t}:function(t){var e=sd("Symbol");return rd(e)&&ad(e.prototype,od(t))},hd=String,cd=function(t){try{return hd(t)}catch(t){return"Object"}},dd=Hc,ud=cd,pd=TypeError,gd=function(t){if(dd(t))return t;throw pd(ud(t)+" is not a function")},fd=gd,md=Ec,yd=function(t,e){var i=t[e];return md(i)?void 0:fd(i)},_d=oc,vd=Hc,bd=Vc,xd=TypeError,Sd={exports:{}},wd=tc,Ad=Object.defineProperty,kd=function(t,e){try{Ad(wd,t,{value:e,configurable:!0,writable:!0})}catch(i){wd[t]=e}return e},Md=kd,Cd="__core-js_shared__",Td=tc[Cd]||Md(Cd,{}),Ed=Td;(Sd.exports=function(t,e){return Ed[t]||(Ed[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Pd=Sd.exports,Rd=Bc,Bd=Object,Id=function(t){return Bd(Rd(t))},Dd=Id,Ld=vc({}.hasOwnProperty),Od=Object.hasOwn||function(t,e){return Ld(Dd(t),e)},Fd=vc,zd=0,Hd=Math.random(),jd=Fd(1..toString),Nd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+jd(++zd+Hd,36)},Vd=Pd,Wd=Od,Ud=Nd,Gd=id,Yd=nd,Xd=tc.Symbol,$d=Vd("wks"),Kd=Yd?Xd.for||Xd:Xd&&Xd.withoutSetter||Ud,qd=function(t){return Wd($d,t)||($d[t]=Gd&&Wd(Xd,t)?Xd[t]:Kd("Symbol."+t)),$d[t]},Zd=oc,Jd=Vc,Qd=ld,tu=yd,eu=function(t,e){var i,n;if("string"===e&&vd(i=t.toString)&&!bd(n=_d(i,t)))return n;if(vd(i=t.valueOf)&&!bd(n=_d(i,t)))return n;if("string"!==e&&vd(i=t.toString)&&!bd(n=_d(i,t)))return n;throw xd("Can't convert object to primitive value")},iu=TypeError,nu=qd("toPrimitive"),su=function(t,e){if(!Jd(t)||Qd(t))return t;var i,n=tu(t,nu);if(n){if(void 0===e&&(e="default"),i=Zd(n,t,e),!Jd(i)||Qd(i))return i;throw iu("Can't convert object to primitive value")}return void 0===e&&(e="number"),eu(t,e)},ru=ld,au=function(t){var e=su(t,"string");return ru(e)?e:e+""},ou=Vc,lu=tc.document,hu=ou(lu)&&ou(lu.createElement),cu=function(t){return hu?lu.createElement(t):{}},du=cu,uu=!nc&&!ic((function(){return 7!=Object.defineProperty(du("div"),"a",{get:function(){return 7}}).a})),pu=nc,gu=oc,fu=lc,mu=gc,yu=Lc,_u=au,vu=Od,bu=uu,xu=Object.getOwnPropertyDescriptor;ec.f=pu?xu:function(t,e){if(t=yu(t),e=_u(e),bu)try{return xu(t,e)}catch(t){}if(vu(t,e))return mu(!gu(fu.f,t,e),t[e])};var Su={},wu=nc&&ic((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Au=Vc,ku=String,Mu=TypeError,Cu=function(t){if(Au(t))return t;throw Mu(ku(t)+" is not an object")},Tu=nc,Eu=uu,Pu=wu,Ru=Cu,Bu=au,Iu=TypeError,Du=Object.defineProperty,Lu=Object.getOwnPropertyDescriptor,Ou="enumerable",Fu="configurable",zu="writable";Su.f=Tu?Pu?function(t,e,i){if(Ru(t),e=Bu(e),Ru(i),"function"==typeof t&&"prototype"===e&&"value"in i&&zu in i&&!i[zu]){var n=Lu(t,e);n&&n[zu]&&(t[e]=i.value,i={configurable:Fu in i?i[Fu]:n[Fu],enumerable:Ou in i?i[Ou]:n[Ou],writable:!1})}return Du(t,e,i)}:Du:function(t,e,i){if(Ru(t),e=Bu(e),Ru(i),Eu)try{return Du(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Iu("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var Hu=Su,ju=gc,Nu=nc?function(t,e,i){return Hu.f(t,e,ju(1,i))}:function(t,e,i){return t[e]=i,t},Vu={exports:{}},Wu=nc,Uu=Od,Gu=Function.prototype,Yu=Wu&&Object.getOwnPropertyDescriptor,Xu=Uu(Gu,"name"),$u={EXISTS:Xu,PROPER:Xu&&"something"===function(){}.name,CONFIGURABLE:Xu&&(!Wu||Wu&&Yu(Gu,"name").configurable)},Ku=Hc,qu=Td,Zu=vc(Function.toString);Ku(qu.inspectSource)||(qu.inspectSource=function(t){return Zu(t)});var Ju,Qu,tp,ep=qu.inspectSource,ip=Hc,np=tc.WeakMap,sp=ip(np)&&/native code/.test(String(np)),rp=Nd,ap=Pd("keys"),op=function(t){return ap[t]||(ap[t]=rp(t))},lp={},hp=sp,cp=tc,dp=Vc,up=Nu,pp=Od,gp=Td,fp=op,mp=lp,yp="Object already initialized",_p=cp.TypeError,vp=cp.WeakMap;if(hp||gp.state){var bp=gp.state||(gp.state=new vp);bp.get=bp.get,bp.has=bp.has,bp.set=bp.set,Ju=function(t,e){if(bp.has(t))throw _p(yp);return e.facade=t,bp.set(t,e),e},Qu=function(t){return bp.get(t)||{}},tp=function(t){return bp.has(t)}}else{var xp=fp("state");mp[xp]=!0,Ju=function(t,e){if(pp(t,xp))throw _p(yp);return e.facade=t,up(t,xp,e),e},Qu=function(t){return pp(t,xp)?t[xp]:{}},tp=function(t){return pp(t,xp)}}var Sp={set:Ju,get:Qu,has:tp,enforce:function(t){return tp(t)?Qu(t):Ju(t,{})},getterFor:function(t){return function(e){var i;if(!dp(e)||(i=Qu(e)).type!==t)throw _p("Incompatible receiver, "+t+" required");return i}}},wp=vc,Ap=ic,kp=Hc,Mp=Od,Cp=nc,Tp=$u.CONFIGURABLE,Ep=ep,Pp=Sp.enforce,Rp=Sp.get,Bp=String,Ip=Object.defineProperty,Dp=wp("".slice),Lp=wp("".replace),Op=wp([].join),Fp=Cp&&!Ap((function(){return 8!==Ip((function(){}),"length",{value:8}).length})),zp=String(String).split("String"),Hp=Vu.exports=function(t,e,i){"Symbol("===Dp(Bp(e),0,7)&&(e="["+Lp(Bp(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Mp(t,"name")||Tp&&t.name!==e)&&(Cp?Ip(t,"name",{value:e,configurable:!0}):t.name=e),Fp&&i&&Mp(i,"arity")&&t.length!==i.arity&&Ip(t,"length",{value:i.arity});try{i&&Mp(i,"constructor")&&i.constructor?Cp&&Ip(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Pp(t);return Mp(n,"source")||(n.source=Op(zp,"string"==typeof e?e:"")),t};Function.prototype.toString=Hp((function(){return kp(this)&&Rp(this).source||Ep(this)}),"toString");var jp=Vu.exports,Np=Hc,Vp=Su,Wp=jp,Up=kd,Gp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Np(i)&&Wp(i,r,n),n.global)s?t[e]=i:Up(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Vp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Yp={},Xp=Math.ceil,$p=Math.floor,Kp=Math.trunc||function(t){var e=+t;return(e>0?$p:Xp)(e)},qp=function(t){var e=+t;return e!=e||0===e?0:Kp(e)},Zp=qp,Jp=Math.max,Qp=Math.min,tg=function(t,e){var i=Zp(t);return i<0?Jp(i+e,0):Qp(i,e)},eg=qp,ig=Math.min,ng=function(t){return t>0?ig(eg(t),9007199254740991):0},sg=function(t){return ng(t.length)},rg=Lc,ag=tg,og=sg,lg=function(t){return function(e,i,n){var s,r=rg(e),a=og(r),o=ag(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},hg={includes:lg(!0),indexOf:lg(!1)},cg=Od,dg=Lc,ug=hg.indexOf,pg=lp,gg=vc([].push),fg=function(t,e){var i,n=dg(t),s=0,r=[];for(i in n)!cg(pg,i)&&cg(n,i)&&gg(r,i);for(;e.length>s;)cg(n,i=e[s++])&&(~ug(r,i)||gg(r,i));return r},mg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yg=fg,_g=mg.concat("length","prototype");Yp.f=Object.getOwnPropertyNames||function(t){return yg(t,_g)};var vg={};vg.f=Object.getOwnPropertySymbols;var bg=Gc,xg=Yp,Sg=vg,wg=Cu,Ag=vc([].concat),kg=bg("Reflect","ownKeys")||function(t){var e=xg.f(wg(t)),i=Sg.f;return i?Ag(e,i(t)):e},Mg=Od,Cg=kg,Tg=ec,Eg=Su,Pg=ic,Rg=Hc,Bg=/#|\.prototype\./,Ig=function(t,e){var i=Lg[Dg(t)];return i==Fg||i!=Og&&(Rg(e)?Pg(e):!!e)},Dg=Ig.normalize=function(t){return String(t).replace(Bg,".").toLowerCase()},Lg=Ig.data={},Og=Ig.NATIVE="N",Fg=Ig.POLYFILL="P",zg=Ig,Hg=tc,jg=ec.f,Ng=Nu,Vg=Gp,Wg=kd,Ug=function(t,e,i){for(var n=Cg(e),s=Eg.f,r=Tg.f,a=0;ar;r++)if((o=y(t[r]))&&vm(km,o))return o;return new Am(!1)}n=bm(t,s)}for(l=u?t.next:n.next;!(h=gm(l,n)).done;){try{o=y(h.value)}catch(t){Sm(n,"throw",t)}if("object"==typeof o&&o&&vm(km,o))return o}return new Am(!1)},Cm=Yc,Tm=TypeError,Em=function(t,e){if(Cm(e,t))return t;throw Tm("Incorrect invocation")},Pm=qd("iterator"),Rm=!1;try{var Bm=0,Im={next:function(){return{done:!!Bm++}},return:function(){Rm=!0}};Im[Pm]=function(){return this},Array.from(Im,(function(){throw 2}))}catch(rl){}var Dm=Su.f,Lm=Od,Om=qd("toStringTag"),Fm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Lm(t,Om)&&Dm(t,Om,{configurable:!0,value:e})},zm=vc,Hm=gd,jm=Hc,Nm=String,Vm=TypeError,Wm=function(t,e,i){try{return zm(Hm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Um=Cu,Gm=function(t){if("object"==typeof t||jm(t))return t;throw Vm("Can't set "+Nm(t)+" as a prototype")},Ym=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Wm(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Um(i),Gm(n),e?t(i,n):i.__proto__=n,i}}():void 0),Xm=Hc,$m=Vc,Km=Ym,qm=Yg,Zm=tc,Jm=vc,Qm=zg,ty=Gp,ey=Bf,iy=Mm,ny=Em,sy=Hc,ry=Ec,ay=Vc,oy=ic,ly=function(t,e){if(!e&&!Rm)return!1;var i=!1;try{var n={};n[Pm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},hy=Fm,cy=function(t,e,i){var n,s;return Km&&Xm(n=e.constructor)&&n!==i&&$m(s=n.prototype)&&s!==i.prototype&&Km(t,s),t},dy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=Zm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=Jm(o[t]);ty(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!ay(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!ay(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!ay(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Qm(t,!sy(a)||!(s||o.forEach&&!oy((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),ey.enable();else if(Qm(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=oy((function(){d.has(1)})),g=ly((function(t){new a(t)})),f=!s&&oy((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){ny(t,o);var i=cy(new a,t,l);return ry(e)||iy(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,qm({global:!0,constructor:!0,forced:l!=a},h),hy(l,t),s||i.setStrong(l,t,n),l},uy={},py=fg,gy=mg,fy=Object.keys||function(t){return py(t,gy)},my=nc,yy=wu,_y=Su,vy=Cu,by=Lc,xy=fy;uy.f=my&&!yy?Object.defineProperties:function(t,e){vy(t);for(var i,n=by(e),s=xy(e),r=s.length,a=0;r>a;)_y.f(t,i=s[a++],n[i]);return t};var Sy,wy=Gc("document","documentElement"),Ay=Cu,ky=uy,My=mg,Cy=lp,Ty=wy,Ey=cu,Py="prototype",Ry="script",By=op("IE_PROTO"),Iy=function(){},Dy=function(t){return"<"+Ry+">"+t+""},Ly=function(t){t.write(Dy("")),t.close();var e=t.parentWindow.Object;return t=null,e},Oy=function(){try{Sy=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Oy="undefined"!=typeof document?document.domain&&Sy?Ly(Sy):(e=Ey("iframe"),i="java"+Ry+":",e.style.display="none",Ty.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Dy("document.F=Object")),t.close(),t.F):Ly(Sy);for(var n=My.length;n--;)delete Oy[Py][My[n]];return Oy()};Cy[By]=!0;var Fy,zy,Hy,jy=Object.create||function(t,e){var i;return null!==t?(Iy[Py]=Ay(t),i=new Iy,Iy[Py]=null,i[By]=t):i=Oy(),void 0===e?i:ky.f(i,e)},Ny=jp,Vy=Su,Wy=function(t,e,i){return i.get&&Ny(i.get,e,{getter:!0}),i.set&&Ny(i.set,e,{setter:!0}),Vy.f(t,e,i)},Uy=Gp,Gy=function(t,e,i){for(var n in e)Uy(t,n,e[n],i);return t},Yy=!ic((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Xy=Od,$y=Hc,Ky=Id,qy=Yy,Zy=op("IE_PROTO"),Jy=Object,Qy=Jy.prototype,t_=qy?Jy.getPrototypeOf:function(t){var e=Ky(t);if(Xy(e,Zy))return e[Zy];var i=e.constructor;return $y(i)&&e instanceof i?i.prototype:e instanceof Jy?Qy:null},e_=ic,i_=Hc,n_=Vc,s_=t_,r_=Gp,a_=qd("iterator"),o_=!1;[].keys&&("next"in(Hy=[].keys())?(zy=s_(s_(Hy)))!==Object.prototype&&(Fy=zy):o_=!0);var l_=!n_(Fy)||e_((function(){var t={};return Fy[a_].call(t)!==t}));l_&&(Fy={}),i_(Fy[a_])||r_(Fy,a_,(function(){return this}));var h_={IteratorPrototype:Fy,BUGGY_SAFARI_ITERATORS:o_},c_=h_.IteratorPrototype,d_=jy,u_=gc,p_=Fm,g_=jf,f_=function(){return this},m_=Yg,y_=oc,__=Hc,v_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=d_(c_,{next:u_(+!n,i)}),p_(t,s,!1),g_[s]=f_,t},b_=t_,x_=Ym,S_=Fm,w_=Nu,A_=Gp,k_=jf,M_=$u.PROPER,C_=$u.CONFIGURABLE,T_=h_.IteratorPrototype,E_=h_.BUGGY_SAFARI_ITERATORS,P_=qd("iterator"),R_="keys",B_="values",I_="entries",D_=function(){return this},L_=Gc,O_=Wy,F_=nc,z_=qd("species"),H_=jy,j_=Wy,N_=Gy,V_=Hf,W_=Em,U_=Ec,G_=Mm,Y_=function(t,e,i,n,s,r,a){v_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!E_&&t in p)return p[t];switch(t){case R_:case B_:case I_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[P_]||p["@@iterator"]||s&&p[s],f=!E_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=b_(m.call(new t)))!==Object.prototype&&o.next&&(b_(o)!==T_&&(x_?x_(o,T_):__(o[P_])||A_(o,P_,D_)),S_(o,d,!0)),M_&&s==B_&&g&&g.name!==B_&&(C_?w_(p,"name",B_):(u=!0,f=function(){return y_(g,this)})),s)if(l={values:c(B_),keys:r?f:c(R_),entries:c(I_)},a)for(h in l)(E_||u||!(h in p))&&A_(p,h,l[h]);else m_({target:e,proto:!0,forced:E_||u},l);return p[P_]!==f&&A_(p,P_,f,{name:s}),k_[e]=f,l},X_=function(t,e){return{value:t,done:e}},$_=function(t){var e=L_(t);F_&&e&&!e[z_]&&O_(e,z_,{configurable:!0,get:function(){return this}})},K_=nc,q_=Bf.fastKey,Z_=Sp.set,J_=Sp.getterFor,Q_={getConstructor:function(t,e,i,n){var s=t((function(t,s){W_(t,r),Z_(t,{type:e,index:H_(null),first:void 0,last:void 0,size:0}),K_||(t.size=0),U_(s)||G_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=J_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=q_(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),K_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=q_(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return N_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,K_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),K_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=V_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),N_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),K_&&j_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=J_(e),r=J_(n);Y_(t,e,(function(t,e){Z_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?X_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,X_(void 0,!0))}),i?"entries":"values",!i,!0),$_(e)}};dy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Q_);var tv=wc,ev=Array.isArray||function(t){return"Array"==tv(t)},iv=vc,nv=ic,sv=Hc,rv=Zf,av=ep,ov=function(){},lv=[],hv=Gc("Reflect","construct"),cv=/^\s*(?:class|function)\b/,dv=iv(cv.exec),uv=!cv.exec(ov),pv=function(t){if(!sv(t))return!1;try{return hv(ov,lv,t),!0}catch(t){return!1}},gv=function(t){if(!sv(t))return!1;switch(rv(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return uv||!!dv(cv,av(t))}catch(t){return!0}};gv.sham=!0;var fv=!hv||nv((function(){var t;return pv(pv.call)||!pv(Object)||!pv((function(){t=!0}))||t}))?gv:pv,mv=ev,yv=fv,_v=Vc,vv=qd("species"),bv=Array,xv=function(t){var e;return mv(t)&&(e=t.constructor,(yv(e)&&(e===bv||mv(e.prototype))||_v(e)&&null===(e=e[vv]))&&(e=void 0)),void 0===e?bv:e},Sv=Hf,wv=Tc,Av=Id,kv=sg,Mv=function(t,e){return new(xv(t))(0===e?0:e)},Cv=vc([].push),Tv=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=Av(l),f=wv(g),m=Sv(h,c),y=kv(f),_=0,v=d||Mv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Cv(b,u)}else switch(t){case 4:return!1;case 7:Cv(b,u)}return r?-1:n||s?s:b}},Ev={forEach:Tv(0),map:Tv(1),filter:Tv(2),some:Tv(3),every:Tv(4),find:Tv(5),findIndex:Tv(6),filterReject:Tv(7)},Pv=vc,Rv=Gy,Bv=Bf.getWeakData,Iv=Em,Dv=Cu,Lv=Ec,Ov=Vc,Fv=Mm,zv=Od,Hv=Sp.set,jv=Sp.getterFor,Nv=Ev.find,Vv=Ev.findIndex,Wv=Pv([].splice),Uv=0,Gv=function(t){return t.frozen||(t.frozen=new Yv)},Yv=function(){this.entries=[]},Xv=function(t,e){return Nv(t.entries,(function(t){return t[0]===e}))};Yv.prototype={get:function(t){var e=Xv(this,t);if(e)return e[1]},has:function(t){return!!Xv(this,t)},set:function(t,e){var i=Xv(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Vv(this.entries,(function(e){return e[0]===t}));return~e&&Wv(this.entries,e,1),!!~e}};var $v,Kv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Iv(t,r),Hv(t,{type:e,id:Uv++,frozen:void 0}),Lv(s)||Fv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=jv(e),o=function(t,e,i){var n=a(t),s=Bv(Dv(e),!0);return!0===s?Gv(n).set(e,i):s[n.id]=i,t};return Rv(r,{delete:function(t){var e=a(this);if(!Ov(t))return!1;var i=Bv(t);return!0===i?Gv(e).delete(t):i&&zv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!Ov(t))return!1;var i=Bv(t);return!0===i?Gv(e).has(t):i&&zv(i,e.id)}}),Rv(r,i?{get:function(t){var e=a(this);if(Ov(t)){var i=Bv(t);return!0===i?Gv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},qv=mf,Zv=tc,Jv=vc,Qv=Gy,tb=Bf,eb=dy,ib=Kv,nb=Vc,sb=Sp.enforce,rb=ic,ab=sp,ob=Object,lb=Array.isArray,hb=ob.isExtensible,cb=ob.isFrozen,db=ob.isSealed,ub=ob.freeze,pb=ob.seal,gb={},fb={},mb=!Zv.ActiveXObject&&"ActiveXObject"in Zv,yb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},_b=eb("WeakMap",yb,ib),vb=_b.prototype,bb=Jv(vb.set);if(ab)if(mb){$v=ib.getConstructor(yb,"WeakMap",!0),tb.enable();var xb=Jv(vb.delete),Sb=Jv(vb.has),wb=Jv(vb.get);Qv(vb,{delete:function(t){if(nb(t)&&!hb(t)){var e=sb(this);return e.frozen||(e.frozen=new $v),xb(this,t)||e.frozen.delete(t)}return xb(this,t)},has:function(t){if(nb(t)&&!hb(t)){var e=sb(this);return e.frozen||(e.frozen=new $v),Sb(this,t)||e.frozen.has(t)}return Sb(this,t)},get:function(t){if(nb(t)&&!hb(t)){var e=sb(this);return e.frozen||(e.frozen=new $v),Sb(this,t)?wb(this,t):e.frozen.get(t)}return wb(this,t)},set:function(t,e){if(nb(t)&&!hb(t)){var i=sb(this);i.frozen||(i.frozen=new $v),Sb(this,t)?bb(this,t,e):i.frozen.set(t,e)}else bb(this,t,e);return this}})}else qv&&rb((function(){var t=ub([]);return bb(new _b,t,1),!cb(t)}))&&Qv(vb,{set:function(t,e){var i;return lb(t)&&(cb(t)?i=gb:db(t)&&(i=fb)),bb(this,t,e),i==gb&&ub(t),i==fb&&pb(t),this}});var Ab=Gc,kb=vc,Mb=Pd,Cb=Ab("Map"),Tb=Ab("WeakMap"),Eb=kb([].push),Pb=Mb("metadata"),Rb=Pb.store||(Pb.store=new Tb),Bb=function(t,e,i){var n=Rb.get(t);if(!n){if(!i)return;Rb.set(t,n=new Cb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Cb)}return s},Ib={store:Rb,getMap:Bb,has:function(t,e,i){var n=Bb(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Bb(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Bb(i,n,!0).set(t,e)},keys:function(t,e){var i=Bb(t,e,!1),n=[];return i&&i.forEach((function(t,e){Eb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Db=Cu,Lb=Ib.toKey,Ob=Ib.set;Yg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Lb(arguments[3]);Ob(t,e,Db(i),n)}});var Fb=Cu,zb=Ib.toKey,Hb=Ib.getMap,jb=Ib.store;Yg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:zb(arguments[2]),n=Hb(Fb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=jb.get(e);return s.delete(i),!!s.size||jb.delete(e)}});var Nb=Cu,Vb=t_,Wb=Ib.has,Ub=Ib.get,Gb=Ib.toKey,Yb=function(t,e,i){if(Wb(t,e,i))return Ub(t,e,i);var n=Vb(e);return null!==n?Yb(t,n,i):void 0};Yg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Gb(arguments[2]);return Yb(t,Nb(e),i)}});var Xb=vc,$b=Map.prototype,Kb={Map:Map,set:Xb($b.set),get:Xb($b.get),has:Xb($b.has),remove:Xb($b.delete),proto:$b},qb=oc,Zb=vc,Jb=function(t,e,i){for(var n,s,r=i||t.next;!(n=qb(r,t)).done;)if(void 0!==(s=e(n.value)))return s},Qb=Kb.Map,tx=Kb.proto,ex=Zb(tx.forEach),ix=Zb(tx.entries),nx=ix(new Qb).next,sx=gd,rx=Ec,ax=sg,ox=Id,lx=function(t,e,i){return i?Jb(ix(t),(function(t){return e(t[1],t[0])}),nx):ex(t,e)},hx=Kb.Map,cx=Kb.has,dx=Kb.set,ux=vc([].push),px=Yg,gx=vc,fx=Ib,mx=Cu,yx=t_,_x=function(t){var e,i,n,s=ox(this),r=ax(s),a=[],o=new hx,l=rx(t)?function(t){return t}:sx(t);for(e=0;e= than the number of constructor arguments of its base class."},mS=function(t,e){return"@postConstruct error in class "+t+": "+e},yS=function(t,e){return"@preDestroy error in class "+t+": "+e},_S=function(t,e){return"onDeactivation() error in class "+t+": "+e},vS="Maximum call stack size exceeded",bS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(qx,t),userGeneratedMetadata:Reflect.getMetadata($x,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(Kx,t)||[]},t}(),xS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function SS(t){return t instanceof RangeError||t.message===vS}function wS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function AS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=CS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function kS(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||kS(t.parentRequest,e))}function MS(t){t.childRequests.forEach((function(t){if(kS(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=wS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(pS+" "+e)}MS(t)}))}function CS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var TS=function(){function t(t){this.id=sS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),ES=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Vx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),PS=function(t,e){this.parentContext=t,this.rootRequest=e},RS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),BS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),IS=function(){function t(t,e,i,n){this.id=sS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new BS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new ES(Vx,n):n instanceof ES&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:HS(t,i)}return 0}function jS(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Yx],multiInject:e[Xx],targetName:e[Wx],unmanaged:e[Ux]}}var NS=function(){function t(t,e,i,n,s){this.id=sS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function VS(t){return t._bindingDictionary}function WS(t,e,i,n,s){var r=GS(i.container,s.serviceIdentifier),a=[];return r.length===xS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=GS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new NS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case xS.NoBindingsAvailable:if(i.isOptional())return e;var s=wS(t),r=cS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=AS(n,s,GS),new Error(r);case xS.OnlyOneBindingAvailable:return e;case xS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=wS(t),r=hS+" "+s;throw r+=AS(n,s,GS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function US(t,e,i,n,s,r){var a,o;if(null===s){a=WS(t,e,n,null,r),o=new NS(i,n,null,a,r);var l=new PS(n,o);n.addPlan(l)}else a=WS(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===eS.Instance&&null!==e.implementationType){var s=function(t,e){return LS(t,CS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=HS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===iS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=$S(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=ew(ew({},s),{constr:t});n=s.isAsync?function(t){return iw(this,void 0,void 0,(function(){var e,i;return nw(this,(function(n){switch(n.label){case 0:return[4,ow(t.constructorInjections)];case 1:return e=n.sent(),[4,ow(t.propertyInjections)];case 2:return i=n.sent(),[2,aw(ew(ew({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):aw(r)}else n=new t;return n}function aw(t){var e,i=new((e=t.constr).bind.apply(e,sw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function ow(t){return iw(this,void 0,void 0,(function(){var e,i,n,s;return nw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Lw=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Dw,onDeactivations:new Dw}},t}(),Ow=function(){return Ow=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new eA(e,i)})).inSingletonScope().whenTargetNamed(e)}class nA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class sA extends nA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const rA=Symbol.for("EnvContribution"),aA=Symbol.for("Global");var oA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hA=function(t,e){return function(i,n){e(i,n,t)}};let cA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new sA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};cA=oA([Yw(),hA(0,Kw(tA)),hA(0,Xw(rA)),lA("design:paramtypes",[Object])],cA);const dA=kt-1e-8;class uA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>dA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=kt)<0&&(n+=kt),(s%=kt)<0&&(s+=kt),ss;++o,a-=At)g(a);else for(a=n-n%At+At,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const gA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,fA={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},mA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let yA,_A,vA,bA,xA,SA;var wA,AA,kA,MA,CA,TA,EA,PA,RA;function BA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function IA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Ut(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=kt:T>0&&0===r&&(T-=kt);const E=Math.ceil(Math.abs(T/(At+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function OA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class YA extends GA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function XA(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class $A{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function KA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new GA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new $A(s,n),t),s}function qA(t,e,i,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n)}class ZA{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&qA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:qA(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function JA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return KA(t,e);const s=new GA("basis",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new ZA(s,n),t),s}function QA(t){return t<0?-1:1}function tk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(QA(r)+QA(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function ek(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function ik(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class nk{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined2);break;case 3:ik(this,this._t0,ek(this,this._t0),!1!==this._lastDefined2)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,ik(this,ek(this,e=tk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:ik(this,this._t0,e=tk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined}}tryUpdateLength(){return this.context.tryUpdateLength()}}class sk extends nk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function rk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return KA(t,e);const s=new GA("monotoneX",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new nk(s,n),t),s}function ak(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return KA(t,e);const s=new YA("monotoneY",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new sk(s,n),t),s}let ok=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function lk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new GA("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new ok(r,e,s),t),r}class hk{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){this.context.closePath()}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ck(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new GA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?EA.ROW:EA.COLUMN);return function(t,e){XA(t,e)}(new hk(s,n),t),s}function dk(t,e,i){switch(e){case"linear":default:return KA(t,i);case"basis":return JA(t,i);case"monotoneX":return rk(t,i);case"monotoneY":return ak(t,i);case"step":return lk(t,.5,i);case"stepBefore":return lk(t,0,i);case"stepAfter":return lk(t,1,i);case"linearClosed":return ck(t,i)}}class uk extends pA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new uA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([mA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([mA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([mA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([mA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([mA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([mA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([mA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([mA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([mA.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const t=[];t[mA.M]=t=>`M${t[1]} ${t[2]}`,t[mA.L]=t=>`L${t[1]} ${t[2]}`,t[mA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[mA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[mA.A]=t=>{const e=[];DA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tSA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),OA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===EA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ct(t.p0.y-e.p1.y)}if(this.direction===EA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ct(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const pk=["l",0,0,0,0,0,0,0];function gk(t,e,i){const n=pk[0]=t[0];if("a"===n||"A"===n)pk[1]=e*t[1],pk[2]=i*t[2],pk[3]=t[3],pk[4]=t[4],pk[5]=t[5],pk[6]=e*t[6],pk[7]=i*t[7];else if("h"===n||"H"===n)pk[1]=e*t[1];else if("v"===n||"V"===n)pk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Ek=Object.assign(Object.assign({},xk),{points:[],cornerRadius:0}),Pk=Object.assign(Object.assign({},xk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Rk=Object.assign(Object.assign({},xk),{width:0,height:0,cornerRadius:0,length:0}),Bk=Object.assign(Object.assign({},xk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Ik=Object.assign(Object.assign(Object.assign({},xk),vk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dk=Object.assign(Object.assign({},xk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Lk=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},xk),{fill:!0}),Ok=Object.assign(Object.assign({},Lk),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});var Fk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Ik.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};zk=Fk([Yw()],zk);var Hk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const jk=Symbol.for("TextMeasureContribution");let Nk=class extends zk{};Nk=Hk([Yw()],Nk);const Vk=new jw;const Wk=new class{},Uk=Symbol.for("CanvasFactory"),Gk=Symbol.for("Context2dFactory");function Yk(t){return Vk.getNamed(Uk,Wk.global.env)(t)}const Xk=1e-4,$k=Math.sqrt(3),Kk=1/3;function qk(t){return t>-cM&&tcM||t<-cM}const Jk=[0,0],Qk=[0,0],tM=[0,0];function eM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function iM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function nM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function sM(t){return(t%=Mt)<0&&(t+=Mt),t}function rM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function aM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Mt);let d=Math.atan2(l,o);return d<0&&(d+=Mt),d>=n&&d<=s||d+Mt>=n&&d+Mt<=s}function hM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(qk(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const uM=[-1,-1,-1],pM=[-1,-1];function gM(){const t=pM[0];pM[0]=pM[1],pM[1]=t}function fM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(qk(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Kk):Math.pow(i,Kk),n=n<0?-Math.pow(-n,Kk):Math.pow(n,Kk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+$k*Math.sin(e)))/(3*a),h=(-o+i*(n-$k*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,uM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&gM(),p=nM(e,n,r,o,pM[0]),u>1&&(g=nM(e,n,r,o,pM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(qk(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,uM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=iM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);uM[0]=-l,uM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Mt-1e-4){n=0,s=Mt;const e=r?1:-1;return a>=uM[0]+t&&a<=uM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Mt,s+=Mt);let c=0;for(let e=0;e<2;e++){const i=uM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=s||t+Mt>=n&&t+Mt<=s)&&(t>wt/2&&t<1.5*wt&&(e=-e),c+=e)}}return c}function _M(t){return Math.round(t/wt*1e8)/1e8%2*wt}function vM(t,e){let i=_M(t[0]);i<0&&(i+=Mt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Mt?s=i+Mt:e&&i-s>=Mt?s=i-Mt:!e&&i>s?s=i+(Mt-_M(i-s)):e&&i1&&(i||(h+=rM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;bM[0]=S,bM[1]=w,vM(bM,Boolean(a[6])),S=bM[0],w=bM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case mA.M:u=m,p=y,c=u,d=p;break;case mA.L:if(i){if(hM(c,d,m,y,e,n,s))return!0}else h+=rM(c,d,m,y,n,s)||0;c=m,d=y;break;case mA.C:if(i){if(oM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=fM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case mA.Q:if(i){if(aM(c,d,m,y,_,v,e,n,s))return!0}else h+=mM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case mA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=rM(c,d,o,l,n,s),i){if(lM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=yM(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case mA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(hM(u,p,o,p,e,n,s)||hM(o,p,o,l,e,n,s)||hM(o,l,u,l,e,n,s)||hM(u,l,u,p,e,n,s))return!0}else h+=rM(o,p,o,l,n,s),h+=rM(u,l,u,p,n,s);break;case mA.Z:if(i){if(hM(c,d,u,p,e,n,s))return!0}else h+=rM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AM=function(t,e){return function(i,n){e(i,n,t)}};let kM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Yk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:vk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ze(Object.assign({defaultFontParams:{fontFamily:vk.fontFamily,fontSize:vk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ze.ALPHABET_CHAR_SET+ze.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var MM;kM=SM([Yw(),AM(0,Kw(tA)),AM(0,Xw(jk)),AM(1,Kw(aA)),wM("design:paramtypes",[Object,Object])],kM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(MM||(MM={}));const CM=new qt;let TM=class{constructor(){this.matrix=new qt}init(t){return this.mode=MM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=MM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(CM.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(CM.a,CM.b,CM.c,CM.d,CM.e,CM.f),this}scale(t,e,i){return this.mode===MM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return CM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(CM.a,CM.b,CM.c,CM.d,CM.e,CM.f),this}translate(t,e){return this.mode===MM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===MM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};TM=SM([Yw(),wM("design:paramtypes",[])],TM);const EM={arc:Sk,area:wk,circle:Ak,line:Ck,path:Tk,symbol:Bk,text:Ik,rect:Pk,rect3d:Rk,polygon:Ek,richtext:Dk,richtextIcon:Ok,image:Lk,group:kk,glyph:Mk},PM=Object.keys(EM);function RM(){return{arc:Object.assign({},EM.arc),area:Object.assign({},EM.area),circle:Object.assign({},EM.circle),line:Object.assign({},EM.line),path:Object.assign({},EM.path),symbol:Object.assign({},EM.symbol),text:Object.assign({},EM.text),rect:Object.assign({},EM.rect),rect3d:Object.assign({},EM.rect3d),polygon:Object.assign({},EM.polygon),richtext:Object.assign({},EM.richtext),richtextIcon:Object.assign({},EM.richtextIcon),image:Object.assign({},EM.image),group:Object.assign({},EM.group),glyph:Object.assign({},EM.glyph)}}function BM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const IM=new Array(60).fill(0).map((()=>RM()));class DM{constructor(){this._defaultTheme=IM.pop()||RM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?BM(this.userTheme,t.userTheme,!1):this.userTheme=P(t.userTheme),BM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);PM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const LM=new DM;function OM(t,e){return t.glyphHost?OM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):LM.getTheme()}return null}(t)||LM.getTheme()}class FM{static GenAutoIncrementId(){return FM.auto_increment_id++}}FM.auto_increment_id=0;var zM=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class HM extends r{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=FM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return zM(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(YM(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=YM(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=YM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=YM(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=GM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(YM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(YM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,YM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof VM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):YM(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof WM))return void console.warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i=0&&t<=C(this.rootTarget,"width")&&e>=0&&e<=C(this.rootTarget,"height")?this.rootTarget:null,i}}const $M={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof jM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new UM(t,e))}},KM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class qM{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new XM(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new VM,this.rootWheelEvent=new WM,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&f(t)&&!E(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class ZM{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const JM=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},QM=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class tC extends r{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=GM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=GM.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||JM(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=QM(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=GM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=QM(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=JM(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=GM.now()-i>this.config.press.time&&QM(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class iC{static Avaliable(){return!0}avaliable(){return iC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class nC{static Avaliable(){return!!Wk.global.getRequestAnimationFrame()}avaliable(){return nC.Avaliable()}tick(t,e){Wk.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var sC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(sC||(sC={}));class rC{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-rC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*rC.bounceIn(2*t):.5*rC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}rC.quadIn=rC.getPowIn(2),rC.quadOut=rC.getPowOut(2),rC.quadInOut=rC.getPowInOut(2),rC.cubicIn=rC.getPowIn(3),rC.cubicOut=rC.getPowOut(3),rC.cubicInOut=rC.getPowInOut(3),rC.quartIn=rC.getPowIn(4),rC.quartOut=rC.getPowOut(4),rC.quartInOut=rC.getPowInOut(4),rC.quintIn=rC.getPowIn(5),rC.quintOut=rC.getPowOut(5),rC.quintInOut=rC.getPowInOut(5),rC.backIn=rC.getBackIn(1.7),rC.backOut=rC.getBackOut(1.7),rC.backInOut=rC.getBackInOut(1.7),rC.elasticIn=rC.getElasticIn(1,.3),rC.elasticOut=rC.getElasticOut(1,.3),rC.elasticInOut=rC.getElasticInOut(1,.3*1.5);const aC=new class{constructor(){this.id=FM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===MA.END?this.removeAnimate(e):e.status===MA.RUNNING||e.status===MA.INITIAL?(this.animateCount++,e.advance(t)):e.status===MA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class oC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class lC extends oC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let hC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:FM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aC;this.id=t,this.timeline=e,this.status=MA.INITIAL,this.tailAnimate=new cC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&CA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:kA.ANIMATE_PLAY})}runCb(t){const e=new lC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===MA.RUNNING&&(this.status=MA.PAUSED)}resume(){this.status===MA.PAUSED&&(this.status=MA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new cC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===MA.RUNNING&&(this.status=MA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=MA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};hC.mode=CA.NORMAL,hC.interpolateMap=new Map;class cC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new dC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?rC[i]:i,s=this._addStep(e,null,n);return s.type=TA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?rC[i]:i,r=this._addStep(e,null,s);return r.type=TA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=TA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=TA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new dC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class dC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const uC=200,pC="cubicOut",gC=1e3,fC="quadInOut";var mC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(mC||(mC={}));const yC=[!1,!1,!1,!1],_C=[0,0,0,0],vC=t=>t?m(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(_C[0]=t[0],_C[2]=t[0],_C[1]=t[1],_C[3]=t[1],_C):t:t:0,bC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],xC=[1,2,3,0,1,2,3,0];function SC(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;bC[0].x=i,bC[1].y=i,bC[2].x=-i,bC[3].y=-i;const s=Math.ceil(t/At)%4,r=Math.ceil(e/At)%4;if(n.add(Et(t)*i,Bt(t)*i),n.add(Et(e)*i,Bt(e)*i),s!==r||e-t>wt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ht(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=wC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class PC extends oC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:kA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:kA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:kA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class RC extends PC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=Wk.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class BC extends PC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=Wk.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class IC extends oC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Mt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+wt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z}}class DC extends oC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class LC extends oC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?rC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function OC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function FC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{rt(e,n)&&rt(i,s)||t.push(e,i,n,s,n,s)};function WC(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function UC(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),KC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},qC=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return KC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return KC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);qC(s[0],n,i),qC(s[1],e-n,i)}};var ZC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const JC={};for(const t in ZC)E(ZC,t)&&(JC[ZC[t]]=t);const QC={to:{},get:{}};function tT(t,e,i){return Math.min(Math.max(e,t),i)}function eT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}QC.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=QC.get.hsl(t,n),i="hsl";break;case"hwb":e=QC.get.hwb(t,n),i="hwb";break;default:e=QC.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},QC.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=ZC[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=tT(e[n],0,255);return e[3]=tT(e[3],0,1),e},QC.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=tT(parseFloat(i[2]),0,100),e[2]=tT(parseFloat(i[3]),0,100),e[3]=tT(isNaN(t)?1:t,0,1),e}return null},QC.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=tT(parseFloat(i[2]),0,100),e[2]=tT(parseFloat(i[3]),0,100),e[3]=tT(isNaN(t)?1:t,0,1),e}return null},QC.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},QC.to.keyword=function(t){return JC[t.slice(0,3)]};const iT=QC;var nT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(nT||(nT={}));class sT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===nT.Color1){let e=sT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=QC.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];sT.store1[t]=s,sT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=sT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=QC.get(t),n&&n.value){const e=n.value;sT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],sT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===nT.Color1){if(sT.store1[t])return;sT.store1[t]=i,sT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(sT.store255[t])return;sT.store255[t]=i,sT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function rT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function aT(t,e,i,n,s){if(!t||!e)return t&&rT(t)||e&&rT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=sT.Get(t,nT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=sT.Get(e,nT.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:rT(a)})))});return o?aT(r,l,i,n,s):aT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:hT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:hT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:hT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),rT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}sT.store255={},sT.store1={};const oT=[0,0,0,0],lT=[0,0,0,0];function hT(t,e,i){return sT.Get(t,nT.Color255,oT),sT.Get(e,nT.Color255,lT),`rgba(${Math.round(oT[0]+(lT[0]-oT[0])*i)},${Math.round(oT[1]+(lT[1]-oT[1])*i)},${Math.round(oT[2]+(lT[2]-oT[2])*i)},${oT[3]+(lT[3]-oT[3])*i})`}const cT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=aT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},dT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?WC(t):[],s=WC(e);i&&n&&(i.fromTransform&&UC(n,i.fromTransform.clone().getInverse()),UC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},pT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],gT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!pT.includes(s))return;const r=e[s];h(r)||h(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?sT.Get(t[s],nT.Color255):t[s],to:"string"==typeof r?sT.Get(r,nT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class fT extends oC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;dT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&cT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const mT=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=uT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=gT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new fT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:gC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:fC)),c};class yT extends oC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;dT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&cT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const _T=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>kC.includes(t))(i)||(e[i]=t[i])})),e},vT=(t,e,i)=>{const n=_T(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Wk.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},bT=(t,e,i)=>{const n=[],s=i?null:_T(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:_T(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=YC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Wk.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=YC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Wk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=YC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Wk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return XC(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return XC(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Wk.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:$C(i)}];const n=[];return qC(i,e,n),n})(t,e).forEach((t=>{n.push(Wk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return qC(r,e,h),h})(t,e).forEach((t=>{n.push(Wk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=WC(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Wk.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Wk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&vT(t,n,e),n};class ST{static GetImage(t,e){var i;let n=ST.cache.get(t);n?"fail"===n.loadState?Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},ST.cache.set(t,n),n.dataPromise=Wk.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=ST.cache.get(t);n?"fail"===n.loadState?Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Wk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},ST.cache.set(t,n),n.dataPromise=Wk.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=ST.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},ST.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Wk.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Wk.global.loadBlob(t):"json"===e&&(i.dataPromise=Wk.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}ST.cache=new Map;const wT=new qt,AT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],kT=["x","y"],MT=["scaleX","scaleY"],CT=["angle"],TT=new Ht;class ET extends HM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Wt,this._updateTag=wA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=OM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;TT.x=i+e,TT.y=n+s}else TT.x=i,TT.y=n;return TT}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Wk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Wk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new qt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&wA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&wA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&wA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&wA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&wA.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&wA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=wA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===AA.GLOBAL){const i=new Ht(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Wk.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!h(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:uC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:pC)}else this.setAttributes(t,!1,{type:kA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();E(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=wA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=wA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=wA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&wA.UPDATE_SHAPE_AND_BOUNDS)===wA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=wA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=wA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=wA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=wA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=wA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=fk.x,y:e=fk.y,scaleX:i=fk.scaleX,scaleY:n=fk.scaleY,angle:s=fk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Et(a),f=Bt(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(fk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=wT.setValue(a.a,a.b,a.c,a.d,a.e,a.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Wk.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:kA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:kA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=aT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=aT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=aT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return OM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Wk.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return f(t,!0)?this.pathProxy=(new uk).fromString(t):this.pathProxy=new uk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",x(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(ST.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new UM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}ET.mixin($M);var PT=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function RT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let BT=0;function IT(){return BT++}const DT=IT(),LT=IT(),OT=IT(),FT=IT(),zT=IT(),HT=IT(),jT=IT(),NT=IT(),VT=IT(),WT=IT(),UT=IT(),GT=IT(),YT=IT(),XT=IT(),$T=IT(),KT=IT(),qT=Symbol.for("GraphicService"),ZT=Symbol.for("GraphicCreator");var JT;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(JT||(JT={}));let QT=class t extends ET{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=HT,this._childUpdateTag=wA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new DM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new DM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===AA.GLOBAL){const i=new Ht(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&wA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Wk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Wk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=OM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Wk.graphicService.updateGroupAABBBounds(t,OM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=vC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=wA.CLEAR_BOUNDS,this._childUpdateTag&=wA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=wA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&wA.UPDATE_BOUNDS||(this._childUpdateTag|=wA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Wk.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Wk.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Wk.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Wk.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Wk.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&wA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=Wk.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const tE=Symbol.for("LayerHandlerContribution");class eE extends QT{get offscreen(){return this.layerHandler.offscreen}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=Vk.get(tE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new DM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Wk.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Wk.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var iE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sE=function(t,e){return function(i,n){e(i,n,t)}};let rE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new eE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}};rE=iE([Yw(),sE(0,Kw(aA)),nE("design:paramtypes",[Object])],rE);var aE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lE=function(t,e){return function(i,n){e(i,n,t)}};const hE=Symbol.for("Window"),cE=Symbol.for("WindowHandlerContribution");let dE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new sA(["x","y","width","height"])},this._uid=FM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Vk.getNamed(cE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};aE([Qw(),oE("design:type",Function),oE("design:paramtypes",[]),oE("design:returntype",void 0)],dE.prototype,"postInit",null),dE=aE([Yw(),lE(0,Kw(aA)),oE("design:paramtypes",[Object])],dE);const uE=Symbol.for("TransformUtil"),pE=Symbol.for("GraphicUtil"),gE=Symbol.for("LayerService");var fE=new Nw((t=>{t(cA).toSelf().inSingletonScope(),t(aA).toService(cA),t(dE).to(dE),t(hE).toService(dE),t(kM).toSelf().inSingletonScope(),t(pE).toService(kM),t(TM).toSelf().inSingletonScope(),t(uE).toService(TM),t(rE).toSelf().inSingletonScope(),t(gE).toService(rE)}));function mE(t){return!!t}function yE(t,e){let i;return i=m(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function _E(t,e){return t*e>0}function vE(t,e,i,n){return t*e>0&&i>0&&n>0}function bE(t,e){return t*e>0}function xE(t,e,i,n){return t*e>0&&i>0&&n>0}function SE(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=OM(t,null==r?void 0:r.theme)[t.type],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible}=t.attribute,m=_E(d,u),y=bE(d,g),_=mE(h),v=yE(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return OA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function wE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function kE(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(s=Mt-St)e.moveTo(i+s*Et(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>St&&(e.moveTo(i+r*Et(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*Et(f),T=s*Bt(f),E=r*Et(y),P=r*Bt(y);let R,B,I,D;if((A>St||w>St)&&(R=s*Et(m),B=s*Bt(m),I=r*Et(_),D=r*Bt(_),hSt){const t=Rt(v,k),r=Rt(b,k),o=AE(I,D,C,T,s,t,Number(c)),l=AE(R,B,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Et(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+R,n+s*Bt(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>St)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>St){const t=Rt(S,M),s=Rt(x,M),o=AE(E,P,R,B,r,-s,Number(c)),l=AE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Et(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*Et(_),n+r*Bt(_))}return a?a[3]&&e.lineTo(i+s*Et(l),n+s*Et(l)):e.closePath(),d}class ME{static GetCanvas(){try{return ME.canvas||(ME.canvas=Wk.global.createCanvas({})),ME.canvas}catch(t){return null}}static GetCtx(){if(!ME.ctx){const t=ME.GetCanvas();ME.ctx=t.getContext("2d")}return ME.ctx}}class CE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=ME.GetCanvas(),n=ME.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=CE.dataMap.get(i);return n||(n=new CE(t,e),CE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){CE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return CE.dataMap.get(t)}}CE.dataMap=new Map;class TE{static GetSize(t){for(let e=0;e=t)return TE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=TE.GenKey(t,e,i,n,s),l=TE.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=TE.GenKey(t,e,i,n,s);TE.cache[l]?TE.cache[l].push({width:a,height:o,pattern:r}):TE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}TE.cache={},TE.ImageSize=[20,40,80,160,320,640,1280,2560];const EE=Symbol.for("ArcRenderContribution"),PE=Symbol.for("AreaRenderContribution"),RE=Symbol.for("CircleRenderContribution"),BE=Symbol.for("GroupRenderContribution"),IE=Symbol.for("ImageRenderContribution"),DE=Symbol.for("PathRenderContribution"),LE=Symbol.for("PolygonRenderContribution"),OE=Symbol.for("RectRenderContribution"),FE=Symbol.for("SymbolRenderContribution"),zE=Symbol.for("TextRenderContribution"),HE=Symbol.for("InteractiveSubRenderContribution");var jE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VE=function(t,e){return function(i,n){e(i,n,t)}};let WE=class{constructor(t){this.arcRenderContribitions=t,this.numberType=DT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Ct(d-c),p=d>c;let g=!1;if(sSt||M>St)&&(D=s*Et(v),L=s*Bt(v),O=r*Et(x),F=r*Bt(x),uSt){const t=Rt(S,T),r=Rt(w,T),a=AE(O,F,P,R,s,t,Number(p)),o=AE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>St)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>St){const t=Rt(k,E),s=Rt(A,E),a=AE(B,I,D,L,r,-s,Number(p)),o=AE(P,R,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Et(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,l){const h=OM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x:_=h.x,y:v=h.y}=t.attribute,b=_E(p,g),x=bE(p,m),S=mE(c),w=yE(u,f);if(!t.valid||!y)return;if(!(S||w||d))return;if(!(b||x||a||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=!1;const{isFullStroke:E,stroke:P}=(t=>{var e;let i=!0;if(o(t,!0)){for(let n=0;n<4;n++)yC[n]=t,i&&(i=!(null!==(e=yC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)yC[e]=!!t[e],i&&(i=!!yC[e]);else yC[0]=!1,yC[1]=!1,yC[2]=!1,yC[3]=!1;return{isFullStroke:i,stroke:yC}})(u);if(S||E||d){if(e.beginPath(),kE(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===RA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,_-i,v-n,h),e.fill())),w&&E&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,_-i,v-n,h),e.stroke()))}if(!E&&w){if(e.beginPath(),kE(t,e,i,n,A,k,P),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===RA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if(M&&C){const{startAngle:r,endAngle:o}=t.getParsedAngle();if(Ct(o-r)>=Mt-St){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:o=h.endAngle,fill:c=h.fill}=t.attribute,d=o;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===RA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),aT(o.color,l.color,h,!1)}(0,0,o,s);a||_E&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=OM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};WE=jE([Yw(),VE(0,Kw(tA)),VE(0,Xw(EE)),NE("design:paramtypes",[Object])],WE);var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},YE=function(t,e){return function(i,n){e(i,n,t)}};let XE=class{constructor(t){this.circleRenderContribitions=t,this.numberType=FT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=_E(y,f),w=bE(y,m),A=mE(h),k=yE(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};XE=UE([Yw(),YE(0,Kw(tA)),YE(0,Xw(RE)),GE("design:paramtypes",[Object])],XE);const $E=["radius","startAngle","endAngle",...AT];class KE extends ET{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=FT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=OM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Wk.graphicService.updateCircleAABBBounds(i,OM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=vC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).circle[t]}needUpdateTags(t){for(let e=0;e<$E.length;e++){const i=$E[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$E.length;e++)if(t===$E[e])return!0;return!1}toCustomPath(){var t,e,i;const n=this.attribute,s=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new uk;return o.arc(0,0,s,r,a),o}clone(){return new KE(Object.assign({},this.attribute))}}function qE(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function ZE(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function JE(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class QE{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=KT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=OM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=OM(this).text,n=Wk.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=ZE(c,s),e=JE(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=ZE(c,s),_=JE(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=OM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const g=Wk.graphicUtil.textMeasure,f=new QE(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).text[t]}needUpdateTags(t){for(let e=0;e{VP[t.type]=t}));const WP=["symbolType","size",...AT];let UP=class t extends ET{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=$T}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return m(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=OM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=VP[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new uk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Pt(r,a);return s.transform(0,0,o,o),this._parsedPath=new NP(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=OM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Wk.graphicService.updateSymbolAABBBounds(i,OM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=vC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=NT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=AC(i,n,e))}doUpdateAABBBounds(){const t=OM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateLineAABBBounds(e,OM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const XP=["width","height","cornerRadius",...AT];class $P extends ET{constructor(t){super(t),this.type="rect",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=OM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateRectAABBBounds(e,OM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).rect[t]}needUpdateTags(t){for(let e=0;e{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=Wk.graphicService.updateGlyphAABBBounds(this.attribute,OM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new ZP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const JP={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},QP=!0,tR=!1,eR=/\w|\(|\)/,iR=/[.?!,;:/,。?!、;:]/,nR=/\S/;function sR(t,e,i,n,s){if(!e||e<=0)return 0;const r=Wk.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=function(t,e){let i=e;for(;eR.test(t[i-1])&&eR.test(t[i])||iR.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function rR(t,e){const i=Wk.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class aR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=JP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class oR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=rR(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=rR(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=sR(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=rR(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||tR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||QP;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=sR(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=rR(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const lR=["width","height","image",...AT];class hR extends ET{constructor(t){super(t),this.type="image",this.numberType=jT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=OM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateImageAABBBounds(e,OM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lk[t]}needUpdateTags(t){for(let e=0;e{if(m(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=vC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Lk.width,height:e=Lk.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class dR{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof cR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=JP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof oR){const e=nR.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof cR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=rR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof cR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof cR)break;const{width:n}=rR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof cR?t.width:t.getWidthWithEllips(this.direction)})),e}}class uR{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=JP[this.direction]}store(t){if(t instanceof cR){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new dR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof cR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=sR(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new oR(i,t.newLine,t.character),new oR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const pR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...AT];class gR extends ET{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=XT}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dk.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Dk.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Dk.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Dk.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Dk.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Dk.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Dk.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Dk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=OM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateRichTextAABBBounds(e,OM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Dk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new uR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const fR=["path","customPath",...AT];class mR extends ET{constructor(t){super(t),this.type="path",this.numberType=VT}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=OM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof uk?e.path:(h(this.cache)&&this.doUpdatePathShape(),this.cache instanceof uk?this.cache:t.path)}doUpdateAABBBounds(){const t=OM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updatePathAABBBounds(e,OM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;f(t.path,!0)?this.cache=(new uk).fromString(t.path):t.customPath&&(this.cache=new uk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return OM(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new _R(Object.assign({},this.attribute))}}const vR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...AT];class bR extends ET{constructor(t){super(t),this.type="arc",this.numberType=DT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=OM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(v(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=OM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Xt(e),i=e+r,n&&Ct(r)St&&o>St)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=OM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=It(n*n+s*s)}=this.attribute,o=Ct(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>St&&a>St){const i=e>t?1:-1;let r=Ot(Number(a)/s*Bt(u)),o=Ot(Number(a)/n*Bt(u));return(p-=2*r)>St?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>St?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=OM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Wk.graphicService.updateArcAABBBounds(i,OM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=vC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Mt-St)o.moveTo(0+s*Et(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>St&&(o.moveTo(0+n*Et(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Et(e),r=s*Bt(e),l=n*Et(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new bR(Object.assign({},this.attribute))}}class xR extends bR{constructor(t){super(t),this.type="arc3d",this.numberType=LT}doUpdateAABBBounds(){const t=OM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updateArc3dAABBBounds(e,OM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const SR=["points","cornerRadius",...AT];class wR extends ET{constructor(t){super(t),this.type="polygon",this.numberType=WT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=OM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updatePolygonAABBBounds(e,OM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=AC(i,n,e))}getDefaultAttribute(t){return OM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new wR(Object.assign({},this.attribute))}}class AR extends wR{constructor(t){super(t),this.type="pyramid3d",this.numberType=UT}doUpdateAABBBounds(){const t=OM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Wk.graphicService.updatePyramid3dAABBBounds(e,OM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=vC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var kR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let MR=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};MR=kR([Yw()],MR);var CR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const TR=Symbol.for("RectBoundsContribution");let ER=class extends MR{};ER=CR([Yw()],ER);var PR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const RR=Symbol.for("SymbolBoundsContribution");let BR=class extends MR{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;RT(i,n+r+o/2,!0,a)}return i}};BR=PR([Yw()],BR);var IR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const DR=Symbol.for("CircleBoundsContribution");let LR=class extends MR{};LR=IR([Yw()],LR);var OR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const FR=Symbol.for("ArcBoundsContribution");let zR=class extends MR{};zR=OR([Yw()],zR);var HR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const jR=Symbol.for("PathBoundsContribution");let NR=class extends MR{};NR=HR([Yw()],NR);class VR{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return VR.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XR=function(t,e){return function(i,n){e(i,n,t)}};function $R(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function KR(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function qR(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function ZR(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),$R(t,t,[s+o,r+l,a+h]),$R(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),$R(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=UR.allocate(),n=[0,0];if(y){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}$R(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),$R(i,i,[-n[0],-n[1],0]),qR(t,t,i)}}let JR=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new sA(["graphic"]),onSetStage:new sA(["graphic","stage"]),onRemove:new sA(["graphic"]),onAddIncremental:new sA(["graphic","group","stage"]),onClearIncremental:new sA(["graphic","group","stage"]),beforeUpdateAABBBounds:new sA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new sA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Wt,this.tempAABBBounds2=new Wt}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new uA(t);return OA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),Nt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Mt-St?i.set(-a,-a,a,a):SC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=St?i.set(0,0,0,0):Math.abs(a-o)>Mt-St?i.set(-s,-s,s,s):(SC(o,a,s,i),SC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(m(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){RT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){RT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Nt(e,e,s.transMatrix)}};JR=GR([Yw(),XR(0,Kw(ZT)),XR(1,Kw(tA)),XR(1,Xw(TR)),XR(2,Kw(tA)),XR(2,Xw(RR)),XR(3,Kw(tA)),XR(3,Xw(DR)),XR(4,Kw(tA)),XR(4,Xw(FR)),XR(5,Kw(tA)),XR(5,Xw(jR)),YR("design:paramtypes",[Object,Object,Object,Object,Object,Object])],JR);class QR extends QT{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const tB=["heightLimit","lineClamp"];class eB extends eP{_isValid(){const{text:t}=this.attribute;return m(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=OM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=Wk.graphicUtil.textMeasure,f=new QE(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let vB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=UR.allocate(),s=UR.allocate();ZR(s,t,e),qR(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),UR.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,y,_,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function bB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),xB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=EA.ROW:"y"===n?c=EA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wB=class extends vB{constructor(){super(...arguments),this.numberType=NT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const y=null!==(f=this.z)&&void 0!==f?f:0;bB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:y}),u.cache&&!m(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:_=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,_-c,v-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,_-c,v-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=_E(d,u),y=bE(d,p),_=mE(h),v=yE(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined),s=dk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=dk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],Rt(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function AB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),kB(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),kB(t,l,1,n),o=!1):o=!0}t.closePath()}function kB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=NA(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}wB=SB([Yw()],wB);var MB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TB=function(t,e){return function(i,n){e(i,n,t)}};function EB(t,e,i){switch(e){case"linear":default:return KA(t,i);case"basis":return JA(t,i);case"monotoneX":return rk(t,i);case"monotoneY":return ak(t,i);case"step":return lk(t,.5,i);case"stepBefore":return lk(t,0,i);case"stepAfter":return lk(t,1,i);case"linearClosed":return ck(t,i)}}let PB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=OT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=OM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=_E(y,m),A=mE(f),k=yE(b,x),M=bE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=EB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=EB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const r=EB(i,n),a=EB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],Rt(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=OM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?EA.ROW:EA.COLUMN,Number.isFinite(c)||(o=EA.COLUMN),Number.isFinite(d)||(o=EA.ROW);const u=i*(o===EA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===RA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,y-h,_-c,o),t.fill())),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;m(i)&&i[0]&&!1===i[1]&&(t.beginPath(),bB(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,y-h,_-c,o),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===RA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1}};PB=MB([Yw(),TB(0,Kw(tA)),TB(0,Xw(PE)),CB("design:paramtypes",[Object])],PB);var RB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IB=function(t,e){return function(i,n){e(i,n,t)}};let DB=class extends vB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=OM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=_E(f,p),w=bE(f,g),A=mE(d),k=yE(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)OA(t.pathShape.commandList,e,i,n,1,1,x);else{OA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};DB=RB([Yw(),IB(0,Kw(tA)),IB(0,Xw(DE)),BB("design:paramtypes",[Object])],DB);const LB=wt/2;function OB(t,e,i,n,s,r){let a;if(v(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!U(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-LB,0,!1)}if(t.lineTo(_[0],_[1]),!U(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,LB,!1)}if(t.lineTo(b[0],b[1]),!U(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],LB,wt,!1)}if(t.lineTo(g[0],g[1]),!U(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],wt,wt+LB,!1)}return t.closePath(),t}var FB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HB=function(t,e){return function(i,n){e(i,n,t)}};let jB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:y=l.fillOpacity,lineWidth:_=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=vE(f,y,u,p),A=xE(f,v,u,p),k=mE(h),M=yE(d,_);if(!t.valid||!b)return;if(!(k||M||c))return;if(!(w||A||a||o||c))return;0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),OB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};jB=FB([Yw(),HB(0,Kw(tA)),HB(0,Xw(OE)),zB("design:paramtypes",[Object])],jB);var NB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class extends vB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=$T}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=_E(f,p),A=bE(f,g),k=mE(d),M=yE(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};UB=NB([Yw(),WB(0,Kw(tA)),WB(0,Xw(FE)),VB("design:paramtypes",[Object])],UB);var GB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XB=function(t,e){return function(i,n){e(i,n,t)}};let $B=class extends vB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=_E(f,p),C=bE(f,g),T=mE(d),E=yE(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const P=!b,R=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===RA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,R,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,R);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,R,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,R);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,R))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,R),this.drawUnderLine(_,v,t,i,n+r,R,h,e)))}P&&this.restoreTransformUseContext2d(t,h,R,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=ZE(l,g),m=JE(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=ZE(h,a),f=JE("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};$B=GB([Yw(),XB(0,Kw(tA)),XB(0,Xw(zE)),YB("design:paramtypes",[Object])],$B);var KB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qB=class{};function ZB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iI=function(t,e){return function(i,n){e(i,n,t)}};let nI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:y=l.lineWidth,opacity:_=l.opacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=_E(_,p),w=bE(_,f),A=mE(c),k=yE(d,y);t.valid&&v&&(A||k||g)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||m(u)&&u.every((t=>0===t))?ZB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)ZB(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=QB(l,y,_,c,d),S=QB(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=JB(w,A),M=QB(l,JB(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=OM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);SE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};nI=tI([Yw(),iI(0,Kw(tA)),iI(0,Xw(LE)),eI("design:paramtypes",[Object])],nI);var sI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aI=function(t,e){return function(i,n){e(i,n,t)}};const oI=["","repeat-x","repeat-y","repeat"];let lI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a){const o=OM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=_E(d,u),_=mE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,oI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=OM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};lI=sI([Yw(),aI(0,Kw(tA)),aI(0,Xw(IE)),rI("design:paramtypes",[Object])],lI);const hI=Symbol.for("IncrementalDrawContribution"),cI=Symbol.for("ArcRender"),dI=Symbol.for("Arc3dRender"),uI=Symbol.for("AreaRender"),pI=Symbol.for("CircleRender"),gI=Symbol.for("GraphicRender"),fI=Symbol.for("GroupRender"),mI=Symbol.for("LineRender"),yI=Symbol.for("PathRender"),_I=Symbol.for("PolygonRender"),vI=Symbol.for("RectRender"),bI=Symbol.for("Rect3DRender"),xI=Symbol.for("SymbolRender"),SI=Symbol.for("TextRender"),wI=Symbol.for("RichTextRender"),AI=Symbol.for("Pyramid3dRender"),kI=Symbol.for("GlyphRender"),MI=Symbol.for("ImageRender"),CI=Symbol.for("RenderSelector"),TI=Symbol.for("DrawContribution");function EI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function PI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(m(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const RI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Yk(Object.assign({nativeCanvas:Wk.global.createCanvas(t)},t));const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr};return Yk(Object.assign({nativeCanvas:Wk.global.createCanvas(e)},e))}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};var BI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},II=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DI=function(t,e){return function(i,n){e(i,n,t)}};let LI=class{constructor(){this.time=RA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=OM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};LI=BI([Yw()],LI);let OI=class{constructor(t){this.subRenderContribitions=t,this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};OI=BI([Yw(),DI(0,Kw(tA)),DI(0,Xw(HE)),II("design:paramtypes",[Object])],OI);let FI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=RI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return RI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Mt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};FI=BI([Yw()],FI);var zI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=EI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),kE(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=EI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),kE(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};HI=zI([Yw()],HI);let jI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};jI=zI([Yw()],jI);let NI=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};NI=zI([Yw()],NI);var VI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=EI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=EI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};WI=VI([Yw()],WI);let UI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};UI=VI([Yw()],UI);let GI=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};GI=VI([Yw()],GI);var YI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let XI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};XI=YI([Yw()],XI);var $I=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=OM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};KI=$I([Yw()],KI);var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZI=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=EI(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),OB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=EI(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),OB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};ZI=qI([Yw()],ZI);let JI=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};JI=qI([Yw()],JI);let QI=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};QI=qI([Yw()],QI);let tD=class{constructor(){this.time=RA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};tD=qI([Yw()],tD);let eD=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};eD=qI([Yw()],eD);var iD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let nD=class{constructor(){this.time=RA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=EI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=EI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};nD=iD([Yw()],nD);class sD extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}}class rD extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}}var aD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lD=function(t,e){return function(i,n){e(i,n,t)}};const hD=Symbol.for("RenderService");let cD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};cD=aD([Yw(),lD(0,Kw(TI)),oD("design:paramtypes",[Object])],cD);var dD=new Nw((t=>{t(cD).toSelf(),t(hD).toService(cD)})),uD=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function pD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return uD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function fD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var mD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const yD=Symbol.for("PickItemInterceptor");let _D=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===LT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};_D=mD([Yw()],_D);var vD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xD=function(t,e){return function(i,n){e(i,n,t)}};const SD=Symbol.for("PickerService");let wD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new qt(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=UR.allocate();if(KR(i,e),a){if(i){const t=UR.allocate();r.modelMatrix=qR(t,a,i),UR.free(i)}}else KR(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Ht(e.x,e.y),a=OM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Ht(e.x,e.y);l.transformPoint(r,r);const a=OM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&UR.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),WR.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};wD=vD([Yw(),xD(0,Kw(aA)),xD(1,Kw(tA)),xD(1,Xw(yD)),bD("design:paramtypes",[Object,Object])],wD);var AD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},MD=function(t,e){return function(i,n){e(i,n,t)}};const CD=Symbol.for("GlobalPickerService");let TD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new qt(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Ht(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function ED(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function PD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}TD=AD([Yw(),MD(0,Kw(aA)),kD("design:paramtypes",[Object])],TD);class RD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=UR.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=UR.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ID=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const DD=[0,0,0],LD=new qt(1,0,0,1,0,0);let OD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},mk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},_k),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new qt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return WR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Mt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&TE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(PD(DD,[t,e,i],this.modelMatrix),t=DD[0],e=DD[1],i=DD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(PD(DD,[t,e,i],this.modelMatrix),t=DD[0],e=DD[1],i=DD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(PD(DD,[e,i,n],this.modelMatrix),e=DD[0],i=DD[1],n=DD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wk.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Wk.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:vk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:vk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(PD(DD,[e,i,n],this.modelMatrix),e=DD[0],i=DD[1],n=DD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=PI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=EI(this,l,this.dpr),r.strokeStyle=PI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=qE(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=qE(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(LD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>WR.free(t))),this.stack.length=0}};OD.env="browser",OD=BD([Yw(),ID("design:paramtypes",[Object,Number])],OD);var FD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const HD={WIDTH:500,HEIGHT:500,DPR:1};let jD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=HD.WIDTH,height:n=HD.HEIGHT,dpr:s=HD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=Wk.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new OD(this,this._dpr),this._id=e.id,this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};jD.env="browser",jD=FD([Yw(),zD("design:paramtypes",[Object])],jD);const ND=Symbol.for("CanvasArcPicker"),VD=Symbol.for("CanvasArc3dPicker"),WD=Symbol.for("CanvasAreaPicker"),UD=Symbol.for("CanvasCirclePicker"),GD=Symbol.for("CanvasImagePicker"),YD=Symbol.for("CanvasLinePicker"),XD=Symbol.for("CanvasPathPicker"),$D=Symbol.for("CanvasRectPicker"),KD=Symbol.for("CanvasRect3dPicker"),qD=Symbol.for("CanvasSymbolPicker"),ZD=Symbol.for("CanvasTextPicker"),JD=Symbol.for("CanvasPolygonPicker"),QD=Symbol.for("CanvasPyramid3dPicker"),tL=Symbol.for("CanvasRichTextPicker"),eL=Symbol.for("CanvasGlyphPicker"),iL=Symbol.for("CanvasPickerContribution"),nL=Symbol.for("MathArcPicker"),sL=Symbol.for("MathAreaPicker"),rL=Symbol.for("MathCirclePicker"),aL=Symbol.for("MathLinePicker"),oL=Symbol.for("MathPathPicker"),lL=Symbol.for("MathRectPicker"),hL=Symbol.for("MathSymbolPicker"),cL=Symbol.for("MathTextPicker"),dL=Symbol.for("MathPolygonPicker"),uL=Symbol.for("MathGlyphPicker"),pL=Symbol.for("MathPickerContribution");var gL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mL=function(t,e){return function(i,n){e(i,n,t)}};let yL=class extends wD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new jD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bL=new qt(1,0,0,1,0,0),xL={x:0,y:0};let SL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0),this.path=new uk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return WR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(WR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},xL),function(t,e,i){return xM(t,0,!1,e,i)}(this.path.commandList,xL.x,xL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},xL);const i=EI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return xM(t,e,!0,i,n)}(this.path.commandList,i,xL.x,xL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(bL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>WR.free(t))),this.stack.length=0}};SL=_L([Yw(),vL("design:paramtypes",[Object,Number])],SL);var wL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kL=function(t,e){return function(i,n){e(i,n,t)}};let ML=class extends wD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new SL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};wL([Qw(),AL("design:type",Function),AL("design:paramtypes",[]),AL("design:returntype",void 0)],ML.prototype,"init",null),ML=wL([Yw(),kL(0,Kw(tA)),kL(0,Xw(pL)),kL(1,Kw(aA)),kL(2,Kw(tA)),kL(2,Xw(yD)),AL("design:paramtypes",[Object,Object,Object])],ML);var CL=new Nw((t=>{t(yL).toSelf().inSingletonScope(),t(ML).toSelf().inSingletonScope(),t(SD).toService(yL),t(TD).toSelf().inSingletonScope(),t(CD).toService(TD),t(_D).toSelf().inSingletonScope(),t(yD).toService(_D),iA(t,yD)})),TL=new Nw((t=>{t(JR).toSelf().inSingletonScope(),t(qT).toService(JR),t(ER).toSelf().inSingletonScope(),t(TR).toService(ER),iA(t,TR),t(BR).toSelf().inSingletonScope(),t(RR).toService(BR),iA(t,RR),t(LR).toSelf().inSingletonScope(),t(DR).toService(LR),iA(t,DR),t(zR).toSelf().inSingletonScope(),t(FR).toService(zR),iA(t,FR),t(NR).toSelf().inSingletonScope(),t(jR).toService(NR),iA(t,jR),t(ZT).toConstantValue(fB)}));const EL=Symbol.for("AutoEnablePlugins"),PL=Symbol.for("PluginService");var RL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IL=function(t,e){return function(i,n){e(i,n,t)}};let DL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Vk.isBound(EL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};DL=RL([Yw(),IL(0,Kw(tA)),IL(0,Xw(EL)),BL("design:paramtypes",[Object])],DL);var LL=new Nw((t=>{t(DL).toSelf(),t(PL).toService(DL),iA(t,EL)})),OL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let FL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}};FL=OL([Yw()],FL);var zL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function jL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let NL=class extends FL{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(b(o)?o:1),y:(s-r.top)/(b(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return jL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return jL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:FM.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}};function VL(){Vk.rebind(SD).toService(ML)}NL=zL([Yw(),HL("design:paramtypes",[])],NL);var WL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GL=class extends FL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),VL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};GL=WL([Yw(),UL("design:paramtypes",[])],GL);var YL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $L=class extends FL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Vk.rebind(SD).toService(ML))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};$L=YL([Yw(),XL("design:paramtypes",[])],$L);var KL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZL=!1;try{ZL=!!lynx.createCanvasNG}catch(t){}let JL=class extends FL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=ZL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,ZL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),VL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};JL=KL([Yw(),qL("design:paramtypes",[])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tO=class extends FL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};tO=QL([Yw()],tO);var eO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let sO=class extends FL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return nO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{VL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};sO=eO([Yw(),iO("design:paramtypes",[])],sO);var rO=new Nw((t=>{t(NL).toSelf().inSingletonScope(),t(rA).toService(NL),t(GL).toSelf().inSingletonScope(),t(rA).toService(GL),t($L).toSelf().inSingletonScope(),t(rA).toService($L),t(JL).toSelf().inSingletonScope(),t(rA).toService(JL),t(sO).toSelf().inSingletonScope(),t(rA).toService(sO),t(tO).toSelf().inSingletonScope(),t(rA).toService(tO),iA(t,rA)})),aO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lO=class{constructor(){this._uid=FM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};lO=aO([Yw(),oO("design:paramtypes",[])],lO);var hO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dO=function(t,e){return function(i,n){e(i,n,t)}};let uO=class extends lO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:FM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new jD(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new jD({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};uO.env="browser",uO=hO([Yw(),dO(0,Kw(aA)),cO("design:paramtypes",[Object])],uO);var pO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gO=class extends OD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};gO.env="feishu",gO=pO([Yw()],gO);var fO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const yO={WIDTH:500,HEIGHT:500,DPR:1};let _O=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=yO.WIDTH,height:n=yO.HEIGHT,dpr:s=yO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new gO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};_O.env="feishu",_O=fO([Yw(),mO("design:paramtypes",[Object])],_O);var vO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xO=function(t,e){return function(i,n){e(i,n,t)}};let SO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new _O(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new _O({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};SO.env="feishu",SO=vO([Yw(),xO(0,Kw(aA)),bO("design:paramtypes",[Object])],SO);var wO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let AO=class extends OD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(PI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(EI(this,l,this.dpr)),r.setStrokeStyle(PI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=qE(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=qE(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};AO.env="taro",AO=wO([Yw()],AO);var kO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const CO={WIDTH:500,HEIGHT:500,DPR:1};let TO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=CO.WIDTH,height:n=CO.HEIGHT,dpr:s=CO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new AO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};TO.env="taro",TO=kO([Yw(),MO("design:paramtypes",[Object])],TO);var EO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RO=function(t,e){return function(i,n){e(i,n,t)}};let BO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new TO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new TO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};BO.env="taro",BO=EO([Yw(),RO(0,Kw(aA)),PO("design:paramtypes",[Object])],BO);var IO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let DO=class extends OD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=EI(this,l,this.dpr),r.strokeStyle=PI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};DO.env="lynx",DO=IO([Yw()],DO);var LO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const FO={WIDTH:500,HEIGHT:500,DPR:1};let zO=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=FO.WIDTH,height:n=FO.HEIGHT,dpr:s=FO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new DO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};zO.env="lynx",zO=LO([Yw(),OO("design:paramtypes",[Object])],zO);var HO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NO=function(t,e){return function(i,n){e(i,n,t)}};let VO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new zO({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};VO.env="lynx",VO=HO([Yw(),NO(0,Kw(aA)),jO("design:paramtypes",[Object])],VO);var WO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GO=class extends OD{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};GO.env="node",GO=WO([Yw(),UO("design:paramtypes",[Object,Number])],GO);var YO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const $O={WIDTH:500,HEIGHT:500,DPR:1};let KO=class{get id(){return this._id}get x(){return 0}get y(){return 0}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=$O.WIDTH,height:n=$O.HEIGHT,canvasControled:s=!0,dpr:r=$O.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new GO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&l(this._nativeCanvas.release)&&this._nativeCanvas.release()}};KO.env="node",KO=YO([Yw(),XO("design:paramtypes",[Object])],KO);var qO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JO=function(t,e){return function(i,n){e(i,n,t)}};let QO=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new KO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new KO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};QO.env="node",QO=qO([Yw(),JO(0,Kw(aA)),ZO("design:paramtypes",[Object])],QO);var tF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eF=class extends OD{draw(){}createPattern(t,e){return null}};eF.env="wx",eF=tF([Yw()],eF);var iF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const sF={WIDTH:500,HEIGHT:500,DPR:1};let rF=class{get id(){return this._id}get x(){return this._x}get y(){return this._y}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t}constructor(t){const{nativeCanvas:e,width:i=sF.WIDTH,height:n=sF.HEIGHT,dpr:s=sF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new eF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};rF.env="wx",rF=iF([Yw(),nF("design:paramtypes",[Object])],rF);var aF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lF=function(t,e){return function(i,n){e(i,n,t)}};class hF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let cF=class extends lO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new hF}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:FM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new rF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new rF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};cF.env="wx",cF=aF([Yw(),lF(0,Kw(aA)),oF("design:paramtypes",[Object])],cF);var dF=new Nw((t=>{t(uO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(uO))).whenTargetNamed(uO.env),t(SO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(SO))).whenTargetNamed(SO.env),t(BO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(BO))).whenTargetNamed(BO.env),t(VO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(VO))).whenTargetNamed(VO.env),t(cF).toSelf(),t(cE).toDynamicValue((t=>t.container.get(cF))).whenTargetNamed(cF.env),t(QO).toSelf(),t(cE).toDynamicValue((t=>t.container.get(QO))).whenTargetNamed(QO.env)})),uF=new Nw((t=>{t(Nk).toSelf().inSingletonScope(),t(jk).toService(Nk),iA(t,jk)})),pF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fF=function(t,e){return function(i,n){e(i,n,t)}};let mF=class{constructor(t){this.global=t,this.offscreen=!1}init(t,e,i){if(this.layer=t,i.main)this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Yk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};mF=pF([Yw(),fF(0,Kw(aA)),gF("design:paramtypes",[Object])],mF);var yF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vF=function(t,e){return function(i,n){e(i,n,t)}};let bF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=Yk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};bF=yF([Yw(),vF(0,Kw(aA)),_F("design:paramtypes",[Object])],bF);var xF=new Nw((t=>{t(mF).toSelf(),t(bF).toSelf(),t(tE).toService(mF)}));var SF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const wF=Symbol.for("DrawItemInterceptor"),AF=new Wt;let kF=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){AF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(AF),!0}};kF=SF([Yw()],kF);let MF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=UR.allocate();KR(l,o);const h=r.modelMatrix;if(h){if(l){const t=UR.allocate();r.modelMatrix=qR(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===LT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&UR.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};MF=SF([Yw()],MF);var CF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EF=function(t,e){return function(i,n){e(i,n,t)}};let PF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=(h=l,c=n.dirtyBounds,d=!1,null===h?c:null===c?h:(ce=h.x1,de=h.x2,ue=h.y1,pe=h.y2,ge=c.x1,fe=c.x2,me=c.y1,ye=c.y2,d&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>=fe||de<=ge||ue>=ye||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ye)}));l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}var h,c,d;this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const u=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),u&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:xk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:xk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=fD(e,i,xk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(!xe(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):pD(t,xk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Vk.get(hI);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let BF=class{selector(t){return null}};BF=RF([Yw()],BF);var IF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LF=function(t,e){return function(i,n){e(i,n,t)}};let OF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=HT}drawShape(t,e,i,n,s,r,a,o){const l=OM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:y=l.fillOpacity,strokeOpacity:_=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=vE(u,y,p,g),A=xE(u,_,p,g),k=mE(h),M=yE(d,x);if(!t.valid||!S)return;if(!f){if(!(k||M||c))return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===v||m(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),OB(e,i,n,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===RA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===RA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=OM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=UR.allocate(),i=UR.allocate();ZR(i,t,a),qR(e,o||e,i),s.modelMatrix=e,UR.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&UR.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};OF=IF([Yw(),LF(0,Kw(tA)),LF(0,Xw(BE)),DF("design:paramtypes",[Object])],OF);var FF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zF=class extends wB{constructor(){super(...arguments),this.numberType=NT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=OM(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,y=_E(u,p),_=bE(u,g),v=mE(c),b=yE(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};zF=FF([Yw()],zF);var HF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jF=class extends PB{constructor(){super(...arguments),this.numberType=OT}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=OM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=_E(u,d),f=mE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};jF=HF([Yw()],jF);var NF,VF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UF=function(t,e){return function(i,n){e(i,n,t)}},GF=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(NF||(NF={}));let YF=class extends PF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=NF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new sA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return GF(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:xk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:xk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return GF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return GF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>GF(this,void 0,void 0,(function*(){if(2!==t.count)yield gD(t,xk.zIndex,((i,n)=>{if(this.status===NF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return GF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return GF(this,void 0,void 0,(function*(){this.rendering&&(this.status=NF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=NF.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return GF(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>GF(this,void 0,void 0,(function*(){yield gD(t,xk.zIndex,(t=>GF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};VF([Kw(aA),WF("design:type",Object)],YF.prototype,"global",void 0),YF=VF([Yw(),UF(0,qw(gI)),UF(1,Kw(CI)),UF(2,Kw(zF)),UF(3,Kw(jF)),UF(4,Kw(gE)),UF(5,Kw(tA)),UF(5,Xw(wF)),WF("design:paramtypes",[Array,Object,Object,Object,Object,Object])],YF);var XF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $F=class extends vB{constructor(){super(...arguments),this.type="rect3d",this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=vE(g,f,u,p),x=xE(g,y,u,p),S=mE(c),w=yE(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=iT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=OM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};$F=XF([Yw()],$F);var KF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qF=class{constructor(){this.numberType=XT}drawShape(t,e,i,n,s){const r=OM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&_E(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=OM(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),OB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=OM(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};qF=KF([Yw()],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JF=class{constructor(){this.numberType=zT}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=OM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};JF=ZF([Yw()],JF);var QF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tz=class extends vB{constructor(){super(...arguments),this.numberType=LT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=_E(p,g),v=bE(p,m),b=mE(c),x=yE(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=iT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(r=Mt-St)e.moveTo(i+r*Et(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>St&&(e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*Et(p),_=r*Bt(p),v=a*Et(f),b=a*Bt(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>St)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Mt,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Ct(h-l),d=h>l;let u=!1;if(a<=St)e.moveTo(i,n,s);else if(c>=Mt-St)e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Et(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Et(c),f=a*Bt(c),m=a*Et(p),y=a*Bt(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=OM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,SE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};tz=QF([Yw()],tz);var ez=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iz=class extends vB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=UT}drawShape(t,e,i,n,s,r,a,o){var l;const h=OM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=_E(u,p),x=bE(u,f),S=mE(c),w=yE(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=iT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=OM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};iz=ez([Yw()],iz);var nz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sz=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};sz=nz([Yw()],sz);let rz=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};rz=nz([Yw()],rz);var az=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let oz=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};oz=az([Yw()],oz);let lz=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}};lz=az([Yw()],lz);var hz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cz=class extends LI{constructor(){super(...arguments),this.time=RA.beforeFillStroke}};cz=hz([Yw()],cz);let dz=class extends FI{constructor(){super(...arguments),this.time=RA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:MC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:MC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:MC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:MC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};dz=hz([Yw()],dz);var uz=new Nw((t=>{t(PF).toSelf(),t(TI).toService(PF),t(YF).toSelf(),t(hI).toService(YF),t(BF).toSelf(),t(CI).toService(BF),t(XE).toSelf().inSingletonScope(),t(pI).to(XE),t(gI).to(XE),t(WI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(GI).toSelf().inSingletonScope(),t(RE).toService(WI),t(RE).toService(UI),t(RE).toService(GI),iA(t,RE),t(jB).toSelf().inSingletonScope(),t(vI).to(jB),t(gI).to(jB),t($F).toSelf().inSingletonScope(),t(bI).toService($F),t(gI).toService(bI),t(ZI).toSelf().inSingletonScope(),t(JI).toSelf().inSingletonScope(),t(QI).toSelf().inSingletonScope(),t(tD).toSelf().inSingletonScope(),t(eD).toSelf().inSingletonScope(),t(OE).toService(ZI),t(OE).toService(JI),t(OE).toService(QI),t(OE).toService(tD),t(OE).toService(eD),iA(t,OE),t($B).toSelf().inSingletonScope(),t(SI).to($B),t(gI).to($B),iA(t,zE),t(DB).toSelf().inSingletonScope(),t(yI).to(DB),t(gI).to(DB),t(oz).toSelf().inSingletonScope(),t(lz).toSelf().inSingletonScope(),t(DE).toService(oz),t(DE).toService(lz),iA(t,DE),t(UB).toSelf().inSingletonScope(),t(xI).to(UB),t(gI).to(UB),t(nD).toSelf().inSingletonScope(),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(FE).toService(nD),t(FE).toService(sD),t(FE).toService(rD),iA(t,FE),t(WE).toSelf().inSingletonScope(),t(cI).to(WE),t(gI).to(WE),t(tz).toSelf().inSingletonScope(),t(dI).toService(tz),t(gI).toService(dI),t(HI).toSelf().inSingletonScope(),t(jI).toSelf().inSingletonScope(),t(NI).toSelf().inSingletonScope(),t(EE).toService(HI),t(EE).toService(jI),t(EE).toService(NI),iA(t,EE),t(wB).toSelf().inSingletonScope(),t(mI).to(wB),t(gI).to(wB),t(zF).toSelf().inSingletonScope(),t(jF).toSelf().inSingletonScope(),t(PB).toSelf().inSingletonScope(),t(uI).to(PB),t(gI).to(PB),t(cz).toSelf().inSingletonScope(),t(dz).toSelf().inSingletonScope(),t(PE).toService(cz),t(PE).toService(dz),iA(t,PE),t(OF).toSelf().inSingletonScope(),t(fI).to(OF),t(gI).to(OF),t(XI).toSelf().inSingletonScope(),t(BE).toService(XI),iA(t,BE),t(nI).toSelf().inSingletonScope(),t(_I).to(nI),t(gI).to(nI),t(sz).toSelf().inSingletonScope(),t(rz).toSelf().inSingletonScope(),t(LE).toService(sz),t(LE).toService(rz),iA(t,LE),t(JF).toSelf().inSingletonScope(),t(kI).toService(JF),t(gI).toService(kI),t(lI).toSelf().inSingletonScope(),t(MI).toService(lI),t(gI).toService(MI),t(KI).toSelf().inSingletonScope(),t(IE).toService(KI),iA(t,IE),t(qF).toSelf().inSingletonScope(),t(wI).toService(qF),t(gI).toService(wI),t(iz).toSelf().inSingletonScope(),t(AI).toService(iz),t(gI).toService(AI),t(OI).toSelf().inSingletonScope(),t(zE).toService(OI),t(EE).toService(OI),t(DE).toService(OI),t(FE).toService(OI),t(OE).toService(OI),t(IE).toService(OI),t(RE).toService(OI),t(PE).toService(OI),t(LE).toService(OI),iA(t,HE),iA(t,gI),t(kF).toSelf().inSingletonScope(),t(wF).toService(kF),t(MF).toSelf().inSingletonScope(),t(wF).toService(MF),iA(t,wF)}));var pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fz=function(t,e){return function(i,n){e(i,n,t)}};let mz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=FT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=EI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};mz=pz([Yw(),fz(0,Kw(pI)),gz("design:paramtypes",[Object])],mz);var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};const bz=new Wt;let xz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=EI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;bz.setValue(i.x1,i.y1,i.x2,i.y2),bz.expand(-r/2),h=!bz.containsPoint(e)}}return n.highPerformanceRestore(),h}};xz=yz([Yw(),vz(0,Kw(vI)),_z("design:paramtypes",[Object])],xz);var Sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Az=function(t,e){return function(i,n){e(i,n,t)}};let kz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=DT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=EI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kz=Sz([Yw(),Az(0,Kw(cI)),wz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=OT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Ez=Mz([Yw(),Tz(0,Kw(uI)),Cz("design:paramtypes",[Object])],Ez);var Pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Rz=class{constructor(){this.type="image",this.numberType=jT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Rz=Pz([Yw()],Rz);var Bz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Iz=class extends vB{};Iz=Bz([Yw()],Iz);var Dz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oz=function(t,e){return function(i,n){e(i,n,t)}};let Fz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=OM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=EI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Fz=Dz([Yw(),Oz(0,Kw(mI)),Lz("design:paramtypes",[Object])],Fz);var zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=EI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Nz=zz([Yw(),jz(0,Kw(yI)),Hz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Gz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=$T}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=OM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=EI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Gz=Vz([Yw(),Uz(0,Kw(xI)),Wz("design:paramtypes",[Object])],Gz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$z=function(t,e){return function(i,n){e(i,n,t)}};let Kz=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=KT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=OM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=JE(a,u,s),y=ZE(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&UR.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Kz=Yz([Yw(),$z(0,Kw(SI)),Xz("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};let Qz=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=WT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Qz=qz([Yw(),Jz(0,Kw(_I)),Zz("design:paramtypes",[Object])],Qz);var tH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let nH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=XT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nH=tH([Yw(),iH(0,Kw(wI)),eH("design:paramtypes",[Object])],nH);var sH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aH=function(t,e){return function(i,n){e(i,n,t)}};let oH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};oH=sH([Yw(),aH(0,Kw(kI)),rH("design:paramtypes",[Object])],oH);var lH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let dH=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=YT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};dH=lH([Yw(),cH(0,Kw(bI)),hH("design:paramtypes",[Object])],dH);var uH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let fH=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};fH=uH([Yw(),gH(0,Kw(AI)),pH("design:paramtypes",[Object])],fH);var mH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_H=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let vH=class extends Iz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=LT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};vH=mH([Yw(),_H(0,Kw(dI)),yH("design:paramtypes",[Object])],vH);var bH=new Nw(((t,e,i,n)=>{t(mz).toSelf().inSingletonScope(),t(UD).toService(mz),t(iL).toService(UD),t(xz).toSelf().inSingletonScope(),t($D).toService(xz),t(iL).toService($D),t(dH).toSelf().inSingletonScope(),t(KD).toService(dH),t(iL).toService(KD),t(kz).toSelf().inSingletonScope(),t(ND).toService(kz),t(iL).toService(ND),t(Ez).toSelf().inSingletonScope(),t(WD).toService(Ez),t(iL).toService(WD),t(Rz).toSelf().inSingletonScope(),t(GD).toService(Rz),t(iL).toService(GD),t(Fz).toSelf().inSingletonScope(),t(YD).toService(Fz),t(iL).toService(YD),t(Nz).toSelf().inSingletonScope(),t(XD).toService(Nz),t(iL).toService(XD),t(Gz).toSelf().inSingletonScope(),t(qD).toService(Gz),t(iL).toService(qD),t(Kz).toSelf().inSingletonScope(),t(ZD).toService(Kz),t(iL).toService(ZD),t(Qz).toSelf().inSingletonScope(),t(JD).toService(Qz),t(iL).toService(JD),t(fH).toSelf().inSingletonScope(),t(QD).toService(fH),t(iL).toService(QD),t(vH).toSelf().inSingletonScope(),t(VD).toService(vH),t(iL).toService(VD),t(nH).toSelf().inSingletonScope(),t(tL).toService(nH),t(iL).toService(tL),t(oH).toSelf().inSingletonScope(),t(eL).toService(oH),t(iL).toService(eL),iA(t,iL)})),xH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wH=function(t,e){return function(i,n){e(i,n,t)}};let AH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=VT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};AH=xH([Yw(),wH(0,Kw(yI)),SH("design:paramtypes",[Object])],AH);var kH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CH=function(t,e){return function(i,n){e(i,n,t)}};let TH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=FT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};TH=kH([Yw(),CH(0,Kw(pI)),MH("design:paramtypes",[Object])],TH);var EH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RH=function(t,e){return function(i,n){e(i,n,t)}};const BH=new Wt;let IH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;BH.setValue(i.x1,i.y1,i.x2,i.y2),BH.expand(-r/2),h=!BH.containsPoint(e)}}return n.highPerformanceRestore(),h}};IH=EH([Yw(),RH(0,Kw(vI)),PH("design:paramtypes",[Object])],IH);var DH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OH=function(t,e){return function(i,n){e(i,n,t)}};let FH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=DT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};FH=DH([Yw(),OH(0,Kw(cI)),LH("design:paramtypes",[Object])],FH);var zH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jH=function(t,e){return function(i,n){e(i,n,t)}};let NH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=OT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};NH=zH([Yw(),jH(0,Kw(uI)),HH("design:paramtypes",[Object])],NH);var VH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let GH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=NT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};GH=VH([Yw(),UH(0,Kw(mI)),WH("design:paramtypes",[Object])],GH);var YH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$H=function(t,e){return function(i,n){e(i,n,t)}};let KH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=$T}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};KH=YH([Yw(),$H(0,Kw(xI)),XH("design:paramtypes",[Object])],KH);var qH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZH=class{constructor(){this.type="text",this.numberType=KT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};ZH=qH([Yw()],ZH);var JH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tj=function(t,e){return function(i,n){e(i,n,t)}};let ej=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=WT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=OM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ej=JH([Yw(),tj(0,Kw(_I)),QH("design:paramtypes",[Object])],ej);var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sj=function(t,e){return function(i,n){e(i,n,t)}};let rj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=zT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};rj=ij([Yw(),sj(0,Kw(kI)),nj("design:paramtypes",[Object])],rj);var aj=new Nw((t=>{t(TH).toSelf().inSingletonScope(),t(rL).toService(TH),t(pL).toService(rL),t(IH).toSelf().inSingletonScope(),t(lL).toService(IH),t(pL).toService(lL),t(FH).toSelf().inSingletonScope(),t(nL).toService(FH),t(pL).toService(nL),t(NH).toSelf().inSingletonScope(),t(sL).toService(NH),t(pL).toService(sL),t(GH).toSelf().inSingletonScope(),t(aL).toService(GH),t(pL).toService(aL),t(AH).toSelf().inSingletonScope(),t(oL).toService(AH),t(pL).toService(oL),t(KH).toSelf().inSingletonScope(),t(hL).toService(KH),t(pL).toService(hL),t(ZH).toSelf().inSingletonScope(),t(cL).toService(ZH),t(pL).toService(cL),t(ej).toSelf().inSingletonScope(),t(dL).toService(ej),t(pL).toService(dL),t(rj).toSelf().inSingletonScope(),t(uL).toService(rj),t(rj).toService(uL),iA(t,pL)}));var oj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new jD(t))).whenTargetNamed(jD.env),t(Gk).toDynamicValue((()=>(t,e)=>new OD(t,e))).whenTargetNamed(OD.env)})),lj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new TO(t))).whenTargetNamed(TO.env),t(Gk).toDynamicValue((()=>(t,e)=>new AO(t,e))).whenTargetNamed(AO.env)})),hj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new _O(t))).whenTargetNamed(_O.env),t(Gk).toDynamicValue((()=>(t,e)=>new gO(t,e))).whenTargetNamed(gO.env)})),cj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new zO(t))).whenTargetNamed(zO.env),t(Gk).toDynamicValue((()=>(t,e)=>new DO(t,e))).whenTargetNamed(DO.env)})),dj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new rF(t))).whenTargetNamed(rF.env),t(Gk).toDynamicValue((()=>(t,e)=>new eF(t,e))).whenTargetNamed(eF.env)})),uj=new Nw((t=>{t(Uk).toDynamicValue((()=>t=>new KO(t))).whenTargetNamed(KO.env),t(Gk).toDynamicValue((()=>(t,e)=>new GO(t,e))).whenTargetNamed(GO.env)}));Vk.load(fE),Vk.load(TL),Vk.load(dD),Vk.load(CL),Vk.load(LL),function(t){t.load(rO),t.load(dF),t.load(uF),t.load(xF)}(Vk),function(t){t.load(uz)}(Vk),function(t){t.load(bH),t.load(aj)}(Vk),function(t){t.load(oj),t.load(hj),t.load(lj),t.load(cj),t.load(dj),t.load(uj)}(Vk);const pj=Vk.get(aA);Wk.global=pj;const gj=Vk.get(pE);Wk.graphicUtil=gj;const fj=Vk.get(uE);Wk.transformUtil=fj;const mj=Vk.get(qT);Wk.graphicService=mj,Vk.get(CD);const yj=Vk.get(gE);Wk.layerService=yj;class _j{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Wk.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Wk.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Wk.graphicService.hooks.onAttributeUpdate.taps=Wk.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.onSetStage.taps=Wk.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class vj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class bj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Wk.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Wk.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Wk.graphicService.hooks.onAddIncremental.taps=Wk.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.onClearIncremental.taps=Wk.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Wk.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const xj=new Wt;class Sj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=FM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Wk.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(xj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(xj,t.parent&&t.parent.globalTransMatrix)))})),Wk.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),Wk.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Wk.graphicService.hooks.beforeUpdateAABBBounds.taps=Wk.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.afterUpdateAABBBounds.taps=Wk.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Wk.graphicService.hooks.onRemove.taps=Wk.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const wj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===sC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=sC.INITIAL,Wk.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Wk.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:nC},{mode:"timeout",cons:iC},{mode:"manual",cons:eC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==sC.INITIAL&&(this.status=sC.PAUSE,!0)}resume(){return this.status!==sC.INITIAL&&(this.status=sC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===sC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===sC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=sC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=sC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};wj.addTimeline(aC),wj.setFPS(60);class Aj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=iT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=It(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Rt(Pt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=f(e)?iT.get(e).value:e;const r=this.colorRgb;return iT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const kj="white";class Mj extends QT{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:kj}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new DM,this.hooks={beforeRender:new sA(["stage"]),afterRender:new sA(["stage"])},this.global=Vk.get(aA),this.window=Vk.get(hE),this.renderService=Vk.get(hD),this.pickerService=Vk.get(SD),this.pluginService=Vk.get(PL),this.layerService=Vk.get(gE),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Wt,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:kj,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new qM({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||wj,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new Aj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new RD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new vj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new _j))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new bj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new Sj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive"}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Ht(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Vk.get(hE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Cj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Cj||(Cj={}));const Tj="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Ej=Tj,Pj=14,Rj=18,Bj=4,Ij={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Pj}}},Dj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Lj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Pj,offset:12,position:"outside"}}},Oj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Pj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Pj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Pj,fill:"#707070",textBaseline:"middle"}}},Fj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Pj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Pj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Pj,fill:"#707070",textBaseline:"middle"}}},zj="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",Hj={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:zj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:zj,fill:"#ddd"}}},jj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Nj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Vj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Pj,fontWeight:"normal",fillOpacity:1}}},Wj={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Pj}}},Uj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Gj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Pj}}},Yj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Pj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Pj}}},Xj={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Pj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Pj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Pj,textBaseline:"middle",textAlign:"center"}}},$j="__VCHART",Kj=500,qj=500,Zj=`${$j}_LABEL_LIMIT`,Jj=`${$j}_LABEL_ALIGN`,Qj=`${$j}_LABEL_TEXT`,tN=`${$j}_LABEL_VISIBLE`,eN=`${$j}_LABEL_X`,iN=`${$j}_LABEL_Y`,nN=`${$j}_ARC_RATIO`,sN=`${$j}_ARC_START_ANGLE`,rN=`${$j}_ARC_END_ANGLE`,aN=`${$j}_ARC_K`,oN=`${$j}_ARC_LABEL_HOVER_AX`,lN=`${$j}_ARC_LABEL_HOVER_AY`,hN=`${$j}_ARC_LABEL_POINT_AX`,cN=`${$j}_ARC_LABEL_POINT_AY`,dN=`${$j}_ARC_LABEL_POINT_BX`,uN=`${$j}_ARC_LABEL_POINT_BY`,pN=`${$j}_ARC_LABEL_POINT_CX`,gN=`${$j}_ARC_LABEL_POINT_CY`,fN=`${$j}_ARC_LABEL_SELECTED_AX`,mN=`${$j}_ARC_LABEL_SELECTED_AY`,yN=`${$j}_ARC_MIDDLE_ANGLE`,_N=`${$j}_ARC_QUADRANT`,vN=`${$j}_ARC_RADIAN`,bN=-Math.PI/2,xN=3*Math.PI/2,SN=-90,wN=270,AN=.6,kN={},MN=[],CN=(t,e,i)=>{kN[t]=Object.assign(e,{type:t}),i||MN.push(t)},TN=()=>{MN.slice().forEach((t=>{(t=>{delete kN[t];const e=MN.indexOf(t);e>=0&&MN.splice(e,1)})(t)}))};function EN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:f(t)?t:h(s=t)?null:s.fname})):null}function PN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function RN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const BN=":vGrammar_identifier:";function IN(t,e){return N(t).reduce(((t,i)=>{const n=f(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function DN(t,e){if(h(t))return[];if(!l(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(f(i))return N(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!l(t)&&!!(null==t?void 0:t.callback)}(t))return IN(t.dependency,e);var i;return[]}function LN(t){return l(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function ON(t,e,i,n){if(h(t))return t;if(l(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return f(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function FN(t,e){return zN(t)?t.output():e[t]}const zN=t=>t&&!h(t.grammarType),HN=t=>l(t)?t:e=>e[t],jN=t=>f(t)&&se.parseColorString(t)?t:null;function NN(t){return!!(null==t?void 0:t.scale)}function VN(t){return!!(null==t?void 0:t.field)}function WN(t,e){if(!t)return[];let i=[];return t.scale&&(i=zN(t.scale)?[t.scale]:N(e.getScaleById(t.scale))),i.concat(DN(t,e))}class UN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return f(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=N(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const GN={},YN=t=>GN[t],XN=(t,e,i,n,s)=>(GN[t]=new UN(e,i,n,s),GN[t]);function $N(t){return null===t?0:t}function KN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const qN=["fillOpacity","x","y","dx","dy"],ZN=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=$N(i.x),["x"]):"y"===e?(t.y=$N(i.y),["y"]):"dx"===e?(t.dx=$N(i.dx),["dx"]):"dy"===e?(t.dy=$N(i.dy),["dy"]):[]};var JN,QN,tV,eV,iV,nV,sV,rV,aV,oV,lV,hV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(JN||(JN={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(QN||(QN={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(tV||(tV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(eV||(eV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(iV||(iV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(nV||(nV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(sV||(sV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(rV||(rV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(aV||(aV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oV||(oV={})),function(t){t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd"}(lV||(lV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(hV||(hV={}));const cV={[QN.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[QN.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),b(e.length)||!b(e.z1)&&b(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):b(e.z1)||!b(e.length)&&b(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[QN.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[QN.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return b(e)&&b(i)&&b(n)&&b(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[QN.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const dV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=f(t)?cV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(qN.includes(r)?ZN(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{qN.includes(t)?ZN(s,t,e):s[t]=e[t]}));return s},uV=(t,e,i)=>!(!h(t)||!h(e))||!h(t)&&!h(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(f(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function pV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case QN.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case QN.group:case QN.rect:case QN.image:return["width","height","y1"].includes(e);case QN.path:case QN.shape:return["path","customPath"].includes(e);case QN.line:return"defined"===e;case QN.area:return["x1","y1","defined"].includes(e);case QN.rule:return["x1","y1"].includes(e);case QN.symbol:return"size"===e;case QN.polygon:return"points"===e;case QN.text:return"text"===e}return!1}function gV(t,e,i,n,s){i&&(LN(i)?e.forEach((e=>{const s=ON(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],c=s&&!pV(t.mark.markType,r)?[e[0]]:e;if(NN(l)){const t=FN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!h(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=f(null==l?void 0:l.field),d=s?ol(l.field):null;let u=s?null:h(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=v(u)||v(i)?u+e+i:u}))}else if(VN(l)){const t=ol(l.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=ON(l,n,e.datum,t)}))})))}function fV(t,e,i,n){if(!t)return null;if(LN(t))return ON(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const c=t[r];if(NN(c)){const t=FN(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!h(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=f(null==c?void 0:c.field),p=u?ol(c.field):null,g=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):h(null==c?void 0:c.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,c.value);s[r]=v(g)||v(d)?g+i+d:g}else if(VN(c)){const t=ol(c.field);s[r]=t(e)}else s[r]=ON(c,n,e,i)})),s}function mV(t){if(t)return t.type===Ol.Band?t.bandwidth():t.type===Ol.Point?t.step():void 0}const yV={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=l(i)?i:ul(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!h(s)){if(h(t))return;t[s]=e}return e})),e;const r=n(e,i);return h(s)||h(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=Ve.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=ol(a),c=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),d=h(t.default)?null:t.default,u=s.map((t=>ol(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),h(n)&&(n=o);const t=o.map((t=>ol(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],l=o.length;return(h(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=h(r)?d:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=EN(i,t.as||[]),s=i.map((t=>f(t)?ol(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Y(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],x=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),w=b(S*_)?S/_:null,A=b(_*_)?_/x:null;return d&&(y[d]=x),p&&(y[p]=S),r&&(y[r]=w),a&&(y[a]=0===i?1:A),o&&(y[o]=!0===g?w:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:S/v[1]),c&&(y[c]=0===i?1:x/v[1]),u&&(y[u]=_),y}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=PN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=RN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return RN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;h(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=h(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=h(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{h(n[BN])&&(n[BN]=0);let s=n[BN];const r=t.as;return e.forEach((t=>{t&&h(t[r])&&(s+=1,t[r]=s)})),n[BN]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=mV(a.y),l="y"===t.dodgeChannel||h(t.dodgeChannel)&&o>0?"y":"x",c="y"===l?o:mV(a.x);if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!h(t.dodgeBy)){const e=sl(N(t.dodgeBy));o=t=>e(t.getDatum())}const d=[];e.forEach((t=>{const e=o(t);d.includes(e)||d.push(e)}));const u=d.length;if(u<1)return e;const p=fl(a,c);let g=p>=c?c:c-p;const f=fl(i,g);let m=(g-Math.max(u-1,0)*f)/u;m>t.maxWidth?(g-=(m-t.maxWidth)*u,m=t.maxWidth):m{y[t]=-g/2+e*(m+f)}));const _=r.markType;"rect"===_||"interval"===_?e.forEach((t=>{const e=o(t),i=y[e],n=t.getItemAttribute();if("x"===l){const e={x:(h(n.width)&&!h(n.x1)?Math.min(n.x,n.x1):n.x)+(h(n.width)?h(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};h(n.width)?e.x1=e.x+m:e.width=m,t.setItemAttributes(e)}else if("y"===l){const e={y:(h(n.height)&&!h(n.y1)?Math.min(n.y,n.y1):n.y)+(h(n.height)?h(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};h(n.height)?e.y1=e.y+m:e.height=m,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=y[e];if("x"===l){const e=t.getItemAttribute("x")+c/2;t.setItemAttributes({x:e+i+m/2})}else if("y"===l){const e=t.getItemAttribute("y")+c/2;t.setItemAttributes({y:e+i+m/2})}}))}return e},markPhase:"afterEncodeItems"}},_V="__vgrammar_scene_item__",vV=[QN.line,QN.area],bV=[QN.arc3d,QN.rect3d,QN.pyramid3d],xV="key",SV=[{}],wV=["key"],AV="VGRAMMAR_IMMEDIATE_ANIMATION",kV=0,MV=1e3,CV=0,TV=!1,EV=!1,PV="quintInOut",RV={stopWhenStateChange:!1,immediatelyApply:!0},BV={},IV=t=>BV[t],DV=(t,e)=>{BV[t]={creator:e}};class LV extends QT{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new uk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Bk.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new uk;let a,o;r.clear();const l=v(s)?s:Pt(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(lV.BEFORE_CREATE_VRENDER_MARK),e===QN.largeRects)return new LV(i);if(e===QN.largeSymbols)return new OV(i);const n=FV[e]?FV[e](i):IV(e)?IV(e).creator(i):null;return t.emit(lV.AFTER_CREATE_VRENDER_MARK),n}function HV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(lV.BEFORE_CREATE_VRENDER_MARK);const n=new ZP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=FV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(lV.AFTER_CREATE_VRENDER_MARK),n}const jV=t=>{t&&(t[_V]=null,t.release(),t.parent&&t.parent.removeChild(t))};class NV{constructor(t){this.data=null,this.states=[],this.diffState=JN.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if(l(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));gV(this,o,a,this.mark.parameters());const h=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[_V]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?dV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),h(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===JN.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(lV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=HN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(lV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=N(ON(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===JN.unChange&&(this.diffState=JN.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==JN.enter&&this.diffState!==JN.update||!this.states.length||this.useStates(this.states),this.mark.markType===QN.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new uk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===JN.enter?(r&&gV(this,t,r,i,o),s&&gV(this,t,s,i,o)):this.diffState===JN.update?(n&&r&&gV(this,t,r,i,o),s&&gV(this,t,s,i,o)):this.diffState===JN.exit&&a&&gV(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=o(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=N(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&f(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=N(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(lV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=o(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(lV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)gl(n,i,t)&&E(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let c=null==l?void 0:l.nextAttrs;if(t&&t.length&&h(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||KN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[QN.line,QN.area,QN.largeRects,QN.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===QN.line||e===QN.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>KN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=$N(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=$N(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=$N(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=$N(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===QN.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>uV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=dV(QN.line,t.attrs,i);return n.points=e.slice(t.startIndex,h(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?Object.assign(c,{segments:e,points:null}):Object.assign(c,{points:t,segments:null})}else p?Object.assign(c,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(c,{points:s,segments:null})}else e===QN.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=$N(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=$N(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=$N(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=$N(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===QN.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=$N(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=$N(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!M(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!h(e=C(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return C(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!E(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!E(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(jV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(jV(this.graphicItem),this.graphicItem[_V]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?h(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):h(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?m(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const VV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(b(e.center.x)&&(s.x=e.center.x),b(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},WV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),UV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const GV=["visible","path","text","lineWidth","textBaseline","textAlign"],YV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:c+u/2,width:h(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:d+p/2,height:h(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:c+u/2,x1:c+u/2,y:d+p/2,y1:d+p/2,width:h(o)?void 0:0,height:h(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:h(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:h(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:h(n)?void 0:0,height:h(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:h(n)?void 0:0}}:{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:h(n)?void 0:0}}:{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:VV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:VV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:WV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WV(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:UV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:UV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return GV.forEach((t=>{delete n[t],delete s[t]})),N(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{gl(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},XV=Object.assign({},YV),$V=t=>XV[t],KV=(t,e)=>{XV[t]=e},qV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.from.min=l,m.to.min=d),b(u)&&(m.from.max=l,m.to.max=u),b(p)&&(m.from.q1=l,m.to.q1=p),b(g)&&(m.from.q3=l,m.to.q3=g),b(f)&&(m.from.median=l,m.to.median=f),m},ZV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.to.min=l,m.from.min=d),b(u)&&(m.to.max=l,m.from.max=u),b(p)&&(m.to.q1=l,m.from.q1=p),b(g)&&(m.to.q3=l,m.from.q3=g),b(f)&&(m.to.median=l,m.from.median=g),m},JV=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(b(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return b(f)?f:b(_)&&b(v)?(_+v)/2:b(m)&&b(y)?(m+y)/2:b(y)?y:b(m)?m:NaN},QV=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),b(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(b(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),b(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const tW=(t,e,i)=>{var n,s,r,a;if(b(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return b(o)?o:b(c)&&b(d)?(c+d)/2:b(l)&&b(h)?(l+h)/2:b(h)?h:b(l)?l:NaN},eW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),b(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(b(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),b(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const iW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},nW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},sW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?nW:iW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},rW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},aW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},oW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function lW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(xV,i?t.slice().sort(i):t.slice()),{keys:wV,data:n};const s=HN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class hW{constructor(t,e,i){this.prevData=lW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const cW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=KN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=KN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const dW=(t,e,i,n,s)=>l(i)?i(t.getDatum(),t,s):i;class uW extends oC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class pW extends oC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{h(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:kA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:kA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}hC.mode|=CA.SET_ATTR_IMMEDIATELY;let gW=0;const fW=t=>!h(t)&&t.prototype instanceof oC;class mW{constructor(t,e,i){this.id=gW++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),b(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=l(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!$V(e.type))return null;const r=$V(e.type)(t,s,i);return cW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return m(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):d(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!h(null===(r=s[i])||void 0===r?void 0:r.from),l=!h(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?dW(t,0,s[i].from,0,n):void 0,e.to[i]=l?dW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),cW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),c=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=fW(o);return h(o)||fW(o)?u?new o(a.from,a.to,r,t.easing,c):a.to?new pW(a.from,a.to,r,t.easing):void 0:new uW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:c})})).filter((t=>!h(t)));1===e.length?t.play(e[0]):t.play(new LC(r,e))}}}function yW(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(_W(i,t[i]))})),e}function _W(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return N(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,c,d,u;if(h(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:kV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:EV,loop:null!==(n=l.loop)&&void 0!==n?n:TV,controlOptions:L({},RV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:MV,delay:null!==(a=l.delay)&&void 0!==a?a:CV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:PV,customParameters:l.customParameters,options:l.options}]}]}}const p=N(t.timeSlices).filter((t=>t.effects&&N(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:kV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:EV,loop:null!==(d=t.loop)&&void 0!==d?d:TV,controlOptions:L({},RV,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:CV,effects:N(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:PV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function vW(t,e,i){return l(t)?t.call(null,e.getDatum(),e,i):t}class bW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!h(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class xW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=yW(null!=e?e:{})}updateConfig(t){this.configs=yW(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==JN.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new bW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=_W(AV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new bW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return h(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=N(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===JN.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(h(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},o),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new mW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===JN.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(lV.ANIMATION_START,d),this.mark.emit(lV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=ON(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=vW(t.startTime,e,s),o=vW(t.totalTime,e,s),l=vW(t.oneByOne,e,s),h=vW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=vW(t.delay,e,s),l=null!==(i=vW(t.duration,e,s))&&void 0!==i?i:o/n,h=N(t.effects).map((t=>Object.assign({},t,{customParameters:vW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=v(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:v(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===JN.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===JN.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===AV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===JN.exit&&0===a[JN.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(lV.ANIMATION_END,h),this.mark.emit(lV.ELEMENT_ANIMATION_END,h,i)}}const SW=(t,e)=>zN(t)?t.output():t&&d(t)?l(t.callback)?i=>t.callback(i,e):l(t.value)?t.value(e):t:t,wW=(t,e)=>t?d(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=SW(s,e),i}),{}):t.map((t=>SW(t,e))):t;var AW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let kW=-1;class MW extends r{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++kW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=N(this.spec.dependency).map((t=>f(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=N(t).map((t=>f(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((i=>{var n;h(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return h(this.spec[e])||this.detach(DN(this.spec[e],this.view)),this.spec[e]=t,this.attach(DN(t,this.view)),this.commit(),this}}const CW=(t,e,i)=>{var n,s;if("callback"===t&&l(e))return{references:[],value:{callback:e,dependency:[]}};if(!h(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!h(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!h(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=DN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},TW=(t,e)=>{const i=(n=t.type,kN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(IN(a,e))));const o=((t,e,i)=>{if(h(e))return{value:e};if(m(e)){const n=e.map((e=>CW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return CW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},EW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=TW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class PW extends NV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if(l(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return gV(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[_V]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?dV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(lV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=o(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(lV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===JN.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==JN.enter&&this.diffState!==JN.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!h(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===JN.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=dV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{E(this.items[0].nextAttrs,e)||E(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=cV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{E(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===QN.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return vV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&E(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),E(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),E(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)gl(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[_V]=null})),this.glyphGraphicItems=null),super.release()}}const RW=t=>t.markType===QN.glyph?new PW(t):new NV(t);function BW(t){return h(t.offsetX)?h(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function IW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return b(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),b(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&b(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&b(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const DW="window",LW="view",OW={trap:!1},FW="default",zW="width",HW="height",jW="viewWidth",NW="viewHeight",VW="padding",WW="viewBox",UW="autoFit";function GW(t,e,i,n,s){if(s===DW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{IW(t,BW(t),!1)}))}));const e=BW(t);IW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var YW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class XW extends MW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new xW(this,{}),this.differ=new hW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=f(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=f(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!h(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===JN.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===oV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:SV,e);let n=i;i.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(lV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(lV.AFTER_MARK_JOIN),this.emit(lV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(lV.AFTER_MARK_STATE),this.emit(lV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(lV.AFTER_MARK_ENCODE)}return this.emit(lV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(lV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>h(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return YW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,h(t)||(f(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return f(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];LN(i)?this.detach(WN(i,this.view)):f(e)?this.detach(WN(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(WN(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return f(e)?(this.spec.encode[t][e]=i,this.attach(WN(i,this.view))):LN(e)?(this.spec.encode[t]=e,this.attach(WN(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(WN(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=EW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=EW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{h(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{h(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return vV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!h(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===JN.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];LN(s)||Object.keys(s).forEach((t=>{NN(s[t])&&(e[t]=FN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[_V];if((null==n?void 0:n.mark)===this){const i=GW(this.view,t,n,e,LW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new xW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=FN(this.spec.group,e);this.group=t,t&&(this.emit(lV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(lV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==QN.group){if(!this.graphicItem){const t=zV(this,QN.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||bV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==QN.group?(h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=HN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>xV),a=HN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>xV),o=this.spec.sort,l=this.spec.groupSort,c=this.isCollectionMark(),d=new Set(this.elements.filter((t=>t.diffState===JN.enter))),u=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(h(e))s=this.elementMap.get(n),s&&(s.diffState=JN.exit);else if(h(i)){s=this.elementMap.has(n)?this.elementMap.get(n):RW(this),s.diffState===JN.exit&&(s.diffState=JN.enter,this.animate.getElementAnimators(s,JN.exit).forEach((t=>t.stop("start")))),s.diffState=JN.enter;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),u.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=JN.update;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),u.push(s)}d.delete(s)}));const p=null!=t?t:SV;this.differ.setCurrentData(lW(p,c?a:t=>`${a(t)}-${r(t)}`,c?l:void 0)),this.differ.doDiff(),d.forEach((t=>{this.elementMap.delete(c?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=u,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(lV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(lV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:zV(this,this.markType,t);if(this.emit(lV.BEFORE_ADD_VRENDER_MARK),this.markType===QN.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(lV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==QN.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=lW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=HN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>xV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=RW(this);e.diffState=JN.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=RW(this);i.diffState=JN.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(LN(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===QN.glyph&&YN(i)){const t=YN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>pV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{pV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(lV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(lV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(pV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(lV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(lV.AFTER_MARK_JOIN),this.emit(lV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(lV.AFTER_MARK_STATE),this.emit(lV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(lV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(lV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(lV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||wV).forEach((t=>{const e=zV(this,QN.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(lV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(lV.AFTER_MARK_STATE),this.emit(lV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(lV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==JN.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return cV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=JN.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&jV(this.graphicItem),this.detachAll(),super.release()}}class $W extends XW{constructor(t,e,i){super(t,QN.component,i),this._componentDatum={[xV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:IV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,xV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[xV]+=1}evaluateJoin(t){return this.spec.key=xV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=f(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=f(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const KW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class qW extends QT{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){p(this.attribute[t])?L(this.attribute[t],e):this.attribute[t]=e,KW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>KW.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){h(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ct(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ct(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===pj.env?(pj.addEventListener("pointermove",this._onSliderPointerMove),pj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===pj.env?(pj.removeEventListener("pointermove",this._onSliderPointerMove),pj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=dt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:We(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=We(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new UM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function JW(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&JW(t,e)}))}ZW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const QW=t=>!h(t)&&!1!==t.visible,tU=["#ffffff","#000000"];function eU(t,e,i,n,s){const r=rU(t),a=rU(e);return iU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...tU);for(const s of r)if(t!==s&&iU(s,e,i,n))return s}(r,a,i,n,s)}function iU(t,e,i,n){return n?nU(t,e)>n:"largeText"===i?nU(t,e)>3:nU(t,e)>4.5}function nU(t,e){const i=sU(t),n=sU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function sU(t){const e=ae(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rU(t){if(null==t?void 0:t.includes("#"))return t;const e=new se(t),{r:i,g:n,b:s}=e.color;return"#"+oe(i,n,s)}function aU(t,e){return[t[0]*e,t[1]*e]}function oU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const lU=-.5*Math.PI,hU=1.5*Math.PI,cU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var dU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(dU||(dU={}));const uU={[dU.selectedReverse]:{},[dU.selected]:{},[dU.hover]:{},[dU.hoverReverse]:{}},pU=(t,e,i)=>new ze(Object.assign({defaultFontParams:{fontFamily:cU,fontSize:11},getTextBounds:i?void 0:yB,specialCharSet:"-/: .,@%'\"~"+ze.ALPHABET_CHAR_SET+ze.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gU(t,e){var i,n;if(!t)return{width:0,height:0};const s=yB({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var fU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sl&&(y=l,k.setAttribute("maxLineWidth",l-g[1]-g[2])));let D=0,L=0;"center"===B?(D-=y/2,m&&m.setAttribute("x",(m.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===B||"end"===B?(D-=y,m&&m.setAttribute("x",(m.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==B&&"start"!==B||f.setAttribute("x",g[3]),"middle"===I?(L-=_/2,m&&m.setAttribute("y",0)):"bottom"===I?(L-=_,m&&m.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===I&&(f.setAttribute("y",g[0]),m&&m.setAttribute("y",E/2));const{visible:O}=s,F=fU(s,["visible"]);if(u&&o(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:O&&!!e,x:D,y:L,width:y,height:_}),"rect");M(null==p?void 0:p.panel)||(t.states=p.panel)}}}mU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};class yU extends qW{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class _U extends yU{constructor(t){super(L({},_U.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}_U.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class vU extends yU{constructor(t){super(L({},vU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}vU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class bU extends yU{constructor(t){super(L({},bU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}bU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class xU extends yU{constructor(t){super(L({},xU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=lU,endAngle:n=hU}=this.attribute,s=n-i,r=Gt(Kt(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}xU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class SU extends yU{constructor(t){super(L({},SU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=$t(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}SU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const wU=new Uint32Array(33),AU=new Uint32Array(33);AU[0]=0,wU[0]=~AU[0];for(let t=1;t<=32;++t)AU[t]=AU[t-1]<<1|1,wU[t]=~AU[t];function kU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&wU[31&n]&AU[1+(31&s)])return!0}else{if(i[r]&wU[31&n])return!0;if(i[a]&AU[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,wU[31&i]&AU[1+(31&s)]);else for(n(r,wU[31&i]),n(a,AU[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,AU[31&i]|wU[1+(31&n)]);else for(s(r,AU[31&i]),s(a,wU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function MU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function CU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=MU(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function TU(t,e){return!(!t||!e)&&e.encloses(t)}function EU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return EU(t,e,s,h,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return EU(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}if("moveX"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return EU(t,e,s,r,null===(c=n.overlap)||void 0===c?void 0:c.clampForce)}return!1}const RU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],BU=["top","inside-top","inside"];const IU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function DU(t,e){var i,n;return null!==(n=null===(i=IU[e])||void 0===i?void 0:i.call(IU,t))&&void 0!==n?n:{from:{},to:{}}}const LU="same-time",OU=300,FU="linear";class zU extends qW{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||M(e.states)||(e.addState(dU.hover,!0),JW(this,(t=>{t===e||M(t.states)||t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(JW(this,(t=>{M(t.states)||(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void JW(this,(t=>{M(t.states)||(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));M(e.states)||(e.addState(dU.selected,!0),JW(this,(t=>{t===e||M(t.states)||t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!M(e)&&(t.states=e)}_createLabelText(t){const e=cB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if(l(s)&&(s=s({})),!s||0===s.length)return[];let r=[];l(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],h=this.getBaseMarkGroup(),c=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==h?void 0:h.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==h?void 0:h.AABBBounds.height())&&void 0!==s?s:0};if(0===c.width||0===c.height)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:p=!0,clampForce:g=!0}=e,f=this._bmpTool||kU(c.width,c.height),m=this._bitmap||f.bitmap(),y=u.some((t=>"bound"===t.type));d&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&m.setRange(MU(f,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:LU,h=null!==(n=a.duration)&&void 0!==n?n:OU,c=null!==(s=a.easing)&&void 0!==s?s:FU,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=DU(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&b(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new CC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(DU(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==kA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===kA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=eU(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=eU(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=eU(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class HU extends zU{constructor(t){super(L({},HU.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}HU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class jU extends zU{constructor(t){super(L({},jU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}jU.tag="rect-label",jU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const NU={rect:jU,symbol:HU};class VU extends qW{constructor(t){super(L({},VU.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!b(n*i))return;this._componentMap||(this._componentMap=new Map);const s=kU(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function WU(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function UU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=jt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function GU(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=WU(t,!!s),o=WU(r,!!s);const h=jt.distancePP(n,l),c=jt.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=UU(e,t,!1,!!s),o=UU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=WU(t,!!s),o=WU(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}VU.defaultAttributes={pickable:!1};class YU extends qW{constructor(t){super(L({},YU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!M(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let h="";if("line"===t||"polygon"===t)h=WU(o,!!n);else if("circle"===t){const{center:t}=this.attribute;h=UU(t,o,!1,!!n)}const c=oB(Object.assign({path:h,z:r},l(i)?L({},YU.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;o.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=WU(o,!!n),g=Ct(o[0].x-o[1].x),f=Ct(o[0].y-o[1].y),m=oB(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*wt/2:0,beta:gf?[o[0].x,0]:[0,o[0].y]},l(i)?L({},YU.defaultAttributes.style,i(t,e)):i));m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${s}`),this.add(m)})),e.length>1&&s)){const t=m(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0:i.size)||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};l=[...l.slice(0,l.length-1),n]}const h=aB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),M(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=dB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),M(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var $U,KU;XU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}($U||($U={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(KU||(KU={}));const qU={[KU.selectedReverse]:{},[KU.selected]:{},[KU.hover]:{},[KU.hoverReverse]:{}},ZU={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var JU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!M(e.states)&&(e.addState(dU.hover,!0),JW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(JW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(dU.selected))return this._lastSelect=null,void JW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));e.name&&!M(e.states)&&(e.addState(dU.selected,!0),JW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);L(this.attribute,t);const i=rB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=rB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,grid:r,items:a,panel:o}=this.attribute,l=rB({x:0,y:0,zIndex:1});if(l.name=$U.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=rB({x:0,y:0,pickable:!1});t.name=$U.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=lB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=$U.background,e.id=this._getNodeId("background"),M(o.state)||(e.states=L({},uU,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){var e;const i=this.getTickLineItems(),n=rB({x:0,y:0,pickable:!1});n.name=$U.tickContainer,n.id=this._getNodeId("tick-container"),t.add(n);const s=M(null===(e=this.attribute.tick)||void 0===e?void 0:e.state)?null:L({},uU,this.attribute.tick.state);i.forEach(((t,e)=>{const r=aB(Object.assign({},this._getTickLineAttribute("tick",t,e,i)));r.name=$U.tick,r.id=this._getNodeId(t.id),r.states=s,n.add(r)})),this.tickLineItems=i;const{subTick:r}=this.attribute;if(null==r?void 0:r.visible){const t=this.getSubTickLineItems();if(t.length){const e=M(r.state)?null:L({},uU,r.state);t.forEach(((t,s)=>{const r=aB(Object.assign({},this._getTickLineAttribute("subTick",t,s,i)));r.name=$U.subTick,r.id=this._getNodeId(`${s}`),r.states=e,n.add(r)}))}this.subTickLineItems=t}}renderLabels(t,e,i){var n;const{dataFilter:s}=this.attribute.label;s&&l(s)&&(e=s(e,i));const r=this._transformItems(e),a=rB({x:0,y:0,pickable:!1});a.name=`${$U.labelContainer}-layer-${i}`,a.id=this._getNodeId(`label-container-layer-${i}`),t.add(a);let o=0,h=0,c="center",d="middle";const u=M(null===(n=this.attribute.label)||void 0===n?void 0:n.state)?null:L({},uU,this.attribute.label.state);return r.forEach(((t,e)=>{var n;const s=this._getLabelAttribute(t,e,r,i),l=cB(s);l.name=$U.label,l.id=this._getNodeId(`layer${i}-label-${t.id}`),l.states=u,a.add(l);const p=null!==(n=s.angle)&&void 0!==n?n:0;o=Math.max(o,l.AABBBounds.width()),h=Math.max(h,l.AABBBounds.height()),p&&(o=Math.abs(o*Math.cos(p)),h=Math.abs(h*Math.sin(p))),c=s.textAlign,d=s.textBaseline})),this.axisLabelLayerSize[i]={width:o,height:h,textAlign:c,textBaseline:d},a}renderTitle(t){const e=this.getTitleAttribute(),i=new mU(Object.assign({},e));i.name=$U.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return rt(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&l(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;Ct(n[0])>Ct(n[1])?o=wt/2*(l.x>e.x?1:-1):h=wt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===_[1]?m+=(this.axisLabelLayerSize[n-1].height+C(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+C(this.attribute,"label.space",4))*n);const v=this.getVerticalCoord(t.point,m,p),b=this.getVerticalVector(m,p,v),x=g?g(t.label,t,e,i,n):t.label;let{style:S}=f;return S=l(S)?L({},ZU.label.style,S(t,e,i,n)):S,S=L({textAlign:this.getTextAlign(b),textBaseline:this.getTextBaseline(b,p)},S),l(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},v),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new YU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${$U.grid}-sub`:`${$U.grid}`,n.id=this._getNodeId(t),e.add(n)}}const tG={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&eG(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function eG(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function iG(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function sG(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Me(t,i),r=Me(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=ke(t),l=ke(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Ae(t.angle);let f=i?t.angle+At:Ae(90-t.angle);const m=i?e.angle:Ae(e.angle);let y=i?e.angle+At:Ae(90-e.angle);f>Mt&&(f-=Mt),y>Mt&&(y-=Mt);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Se(s,i)+Se(s,n))/2>Se(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function rG(t,e){"bottom"!==t&&"top"!==t||function(t,e){let i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var aG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return aU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:m}=l,y=aG(l,["position","space","textStyle","autoRotate","shape","background","state"]);let _=.5;"start"===c?_=0:"end"===c&&(_=1);const{verticalFactor:v=1}=this.attribute,b=-1*v,x=this.getTickCoord(_),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+C(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,T=this.getVerticalCoord(x,k,!1),E=this.getVerticalVector(k,!1);let P,R,{angle:B}=y;if(P="start"===c?"start":"end"===c?"end":"center",h(B)&&p){B=oU(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else P=this.getTextAlign(E),R=this.getTextBaseline(E,!1);const I=Object.assign(Object.assign(Object.assign({},T),y),{textStyle:Object.assign({textAlign:P,textBaseline:R},u),state:M(m)?null:{text:m.text,shape:m.shape,panel:m.background}});return I.angle=B,g&&g.visible&&(I.shape=Object.assign({visible:!0},g.style),g.space&&(I.space=g.space)),f&&f.visible&&(I.panel=Object.assign({visible:!0},f.style)),I}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=lU,endAngle:r=hU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}else{n=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(M(t))return;const{verticalLimitSize:o,label:c,title:d,line:u,tick:p,orient:g}=this.attribute,f=null!==(s=c.space)&&void 0!==s?s:4;let m=o,y=0,_=0;const v=(null==u?void 0:u.visible)?null!==(r=u.style.lineWidth)&&void 0!==r?r:1:0,x=(null==p?void 0:p.visible)?null!==(a=p.length)&&void 0!==a?a:4:0;(null==d?void 0:d.visible)&&(y=gU(d.text,d.textStyle).height,_=d.space),m&&(m=(m-f-_-y-v-x)/n);const{layoutFunc:S,autoRotate:w,autoRotateAngle:A,autoLimit:k,limitEllipsis:C,autoHide:T,autoHideMethod:E,autoHideSeparation:P}=c;l(S)?S(t,e,i,this):(w&&function(t,e){if(M(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Ut(e)})),rG(i,t),!sG(t))break}}(t,{labelRotateAngle:A,orient:g}),k&&b(m)&&m>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!M(t)&&b(i)&&t.forEach((t=>{const e=0===t.attribute.angle||h(t.attribute.angle)?"top"===s||"bottom"===s?null:i:i/Math.sin(t.attribute.angle);t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:m,ellipsis:C,orient:g}),T&&function(t,e){if(M(t))return;const i=t.filter(nG);if(M(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=l(s)?s:tG[s]||tG.parity;if(n.length>=3&&iG(n,r)){do{n=a(n,r)}while(n.length>=3&&iG(n,r));n.length<3&&!V(i).attribute.opacity&&(n.length>1&&V(n).setAttribute("opacity",0),V(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:g,method:E,separation:P}))}}oG.defaultAttributes=ZU;var lG,hG=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=sB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=$U.line,c.id=this._getNodeId("line"),M(null==a?void 0:a.state)||(c.states=L({},qU,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=lU,endAngle:i=hU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=lU,endAngle:i=hU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return $t(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return aU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:m,state:y}=u,_=hG(u,["space","textStyle","shape","background","state"]);let v=l,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=C(this.attribute.label,"style.fontSize",12)+C(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;h(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",v={x:l.x,y:l.y-S}):"end"===A&&(w="top",v={x:l.x,y:l.y+S});const k=Object.assign(Object.assign(Object.assign({},v),_),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:M(y)?null:{text:y.text,shape:y.shape,panel:y.background}}),{angle:T}=_;return k.angle=T,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}cG.defaultAttributes=ZU;class dG extends oC{constructor(){super(...arguments),this.mode=CA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return JW(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},JW(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=b(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=_t.lastIndex=vt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=_t.exec(t))&&(n=vt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=vt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=lG.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=lG.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=lG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=lG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=lG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===lG.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===lG.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=lG.endHandler):this.state.start=this.state.start+o:this._activeTag===lG.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===pj.env&&(pj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),pj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===lG.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ct(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===lG.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ct(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===lG.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=pG(t,["formatMethod"]),{formatMethod:s}=e,r=pG(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:i,size:n,orient:s,middleHandlerStyle:r}=this.attribute,{width:a,height:o}=n,l=null!==(e=null===(t=null==r?void 0:r.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let h,c,d;return(null==r?void 0:r.visible)?this._isHorizontal?(h=a,c=o-l,d={x:i.x,y:i.y+l}):(h=a-l,c=o,d={x:i.x+("left"===s?l:0),y:i.y}):(h=a,c=o,d=i),this._layoutAttrFromConfig={position:d,width:h,height:c},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+P*I,y:B.y,width:(R-P)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+P*D,width:I,height:(R-P)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+P*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(P+R)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+P*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(P+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{position:i,size:n,selectedBackgroundChartStyle:s}=this.attribute,{width:r,height:a}=n,{start:o,end:l}=this.state;this.computeBasePoints(),this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?i.x+o*r:i.x,y:this._isHorizontal?i.y:i.y+o*a,width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?i.x+o*r:i.x),y:-(this._isHorizontal?i.y:i.y+o*a),width:this._isHorizontal?(l-o)*r:r,height:this._isHorizontal?a:(l-o)*a,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==s?void 0:s.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==s?void 0:s.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new mU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;c(t)&&c(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...N(a))}setUpdateStateCallback(t){l(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){l(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){l(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){l(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){l(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){l(t)&&(this._statePointToData=t)}};var fG,mG,yG;gG.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!1,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{symbolType:"M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(fG||(fG={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(mG||(mG={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(yG||(yG={}));class _G extends qW{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=rB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const vG={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:fG.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},bG={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},xG={label:{position:mG.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},SG={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},wG={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};let AG=class t extends _G{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},bG[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new XU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new mU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};AG.defaultAttributes=vG;let kG=class t extends _G{constructor(e){super(L({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},SG[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=pB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new mU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};kG.defaultAttributes=xG;let MG=class t extends _G{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=yG.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},wG[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=dB(Object.assign(Object.assign({},e),n)):"text"===i?o=new mU(Object.assign({},e)):"richText"===i?o=gB(Object.assign(Object.assign({},e),s)):"image"===i?o=uB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new XU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=aB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};MG.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const CG={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class TG extends qW{getCurrent(){return this._current}constructor(t){super(L({},TG.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new UM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new UM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(DG.item)){const t=i.delegate;t.hasState(BG.selected)?this._setLegendItemState(t,BG.selectedHover):this._setLegendItemState(t,BG.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===DG.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(IG.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(DG.item)){const t=i.delegate;t.removeState(BG.unSelectedHover),t.removeState(BG.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(BG.unSelectedHover),t.removeState(BG.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===DG.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(IG.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(DG.item)){const t=a.delegate;if(a.name===DG.focus){const e=t.hasState(BG.focus);t.toggleState(BG.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover,BG.focus]),this._setLegendItemState(t,BG.selected)})):(this._setLegendItemState(t,BG.selected),this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[BG.selected,BG.selectedHover,BG.focus]),this._setLegendItemState(e,BG.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(BG.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(BG.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(IG.legendItemClick,t);n?(this._removeLegendItemState(t,[BG.selected,BG.selectedHover]),this._setLegendItemState(t,BG.unSelected)):(this._setLegendItemState(t,BG.selected),this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover]))}else this._setLegendItemState(t,BG.selected),this._removeLegendItemState(t,[BG.unSelected,BG.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[BG.selected,BG.selectedHover]),this._setLegendItemState(e,BG.unSelected))}))}this._dispatchEvent(IG.legendItemClick,t)}}}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,BG.selected),this._removeLegendItemState(e,[BG.unSelected,BG.unSelectedHover])):(this._removeLegendItemState(e,[BG.selected,BG.selectedHover]),this._setLegendItemState(e,BG.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||M(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=rB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=EG,spaceRow:f=PG,maxWidth:m,width:y,height:_}=t;c(m)?c(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:c(y)&&(this._itemWidthByUser=y),c(_)&&(this._itemHeightByUser=_);let v=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!M(d)||(null==d?void 0:d.includes(t.label)),e),r=i.attribute.width,o=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,o),b=Math.max(r,b),this._itemMaxWidth=Math.max(r,this._itemMaxWidth),p?(w=s,c(l)&&(r>=l?(v=!0,e>0&&(x=0,S+=o+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+r):(w=n,c(h)&&h0&&i.setAttributes({x:x,y:S}),S+=f+o),a.add(i)}));let k=!1;v&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i){const{id:n,label:s,value:r,shape:a}=t,{shape:o={},label:l={},value:d={},padding:u=0,background:p,focus:g,focusIconStyle:f={}}=this.attribute.item,m=We(u);let y;!1===p.visible?(y=rB({x:0,y:0,cursor:null==p?void 0:p.style.cursor}),this._appendDataToShape(y,DG.item,t,y)):(y=rB(Object.assign({x:0,y:0},null==p?void 0:p.style)),this._appendDataToShape(y,DG.item,t,y,null==p?void 0:p.state)),y.addState(e?BG.selected:BG.unSelected);const _=rB({x:0,y:0,pickable:!1});y.add(_);let v=0;const b=C(o,"style.size",10),x=C(o,"space",8),S=dB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},a),o.style));let w;Object.keys(o.state||{}).forEach((t=>{const e=o.state[t].fill||o.state[t].stroke;a.fill&&h(o.state[t].fill)&&e&&(o.state[t].fill=e),a.stroke&&h(o.state[t].stroke)&&e&&(o.state[t].stroke=e)})),this._appendDataToShape(S,DG.itemShape,t,y,null==o?void 0:o.state),S.addState(e?BG.selected:BG.unSelected),_.add(S);let A=0;if(g){const e=C(f,"size",10);w=dB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},f),{visible:!1,pickMode:"imprecise",boundsPadding:m})),this._appendDataToShape(w,DG.focus,t,y),A=e}const k=cB(Object.assign(Object.assign({x:b/2+x,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==l?void 0:l.style.fontSize},null==l?void 0:l.style),{text:l.formatMethod?l.formatMethod(s,t,i):s}));this._appendDataToShape(k,DG.itemLabel,t,y,null==l?void 0:l.state),k.addState(e?BG.selected:BG.unSelected),_.add(k);const M=C(l,"space",8);if(v+=b/2+x+k.AABBBounds.width()+M,c(r)){const n=C(d,"space",g?8:0),s=cB(Object.assign(Object.assign({x:v+M,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null==d?void 0:d.style.fontSize},null==d?void 0:d.style),{text:d.formatMethod?d.formatMethod(r,t,i):r}));this._appendDataToShape(s,DG.itemValue,t,y,null==d?void 0:d.state),s.addState(e?BG.selected:BG.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-b-x-k.AABBBounds.width()-M-A-n),d.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-b/2-m[1]-m[3]-A-n})),v=s.AABBBounds.x2+n,_.add(s)}else this._itemWidthByUser&&k.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-b-x-A);w&&(w.setAttribute("x",v),_.add(w));const T=_.AABBBounds,E=T.width(),P=T.height(),R=this._itemWidthByUser||E+m[1]+m[3],B=this._itemHeightByUser||P+m[0]+m[2];return y.attribute.width=R,y.attribute.height=B,_.translateTo(-T.x1+m[3],-T.y1+m[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=EG,spaceRow:h=PG}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=RG}=o,f=OG(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new TG(Object.assign({layout:1===r?"horizontal":"vertical",total:99},L({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new TG(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=rB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==DG.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==DG.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(BG.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=L({},FG,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new UM(t,{item:e,data:e.data,selected:e.hasState(BG.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}};var HG;function jG(t){return m(t)?t:[t,t]}function NG(t){return t?"ew-resize":"ns-resize"}zG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:EG,spaceRow:PG,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:RG,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(HG||(HG={}));let VG=class t extends qW{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(L({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===pj.env?(pj.addEventListener("pointermove",this._onHandlerPointerMove),pj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ct(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===pj.env)pj.removeEventListener("pointermove",this._onHandlerPointerMove),pj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===pj.env?(pj.addEventListener("pointermove",this._onTrackPointerMove),pj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ct(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ct(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===pj.env?(pj.removeEventListener("pointermove",this._onTrackPointerMove),pj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,d;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(c(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=N(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;h(u)&&(u=[o,l]),this._currentValue={startValue:jG(u)[0],endValue:jG(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=rB({x:0,y:0});g.name=HG.innerView,this.add(g),this._innerView=g;let f,m=0;if(r&&r.visible){f=cB(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=HG.startText,g.add(f);const e=c(r.space)?r.space:0;m+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const y=rB({x:p?m:0,y:p?0:m});g.add(y);const _=rB({x:0,y:0});let v;if(_.name=HG.railContainer,this._railContainer=_,y.add(_),this._renderRail(_),m+=p?n:s,a&&a.visible){const t=c(a.space)?a.space:0;v=cB(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),v.name=HG.endText,g.add(v)}this._renderTrack(_),d&&(this._renderHandlers(y),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=lB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=HG.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:c}=this.attribute;let{value:d}=this.attribute;h(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?l:o,[f,m]=jG(d),y=(f-i)/(n-i)*g,_=this._renderHandler(Object.assign({x:p?y:l/2,y:p?o/2:y,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":NG(p)},r));if(_.name=HG.startHandler,this._startHandler=_,t.add(_),this._currentValue.startPos=y,u){const e=this._renderHandlerText(f);e.name=HG.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(m-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":NG(p)},r));if(a.name=HG.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(m);e.name=HG.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:c}=this.attribute;h(c)&&(c=[i,n]);const u=this._isHorizontal,p=u?r:s;let[g,f]=jG(c);e||(g=i);const m=rB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=HG.trackContainer;const y=d(e)&&!0===e.draggableTrack;let _;_=!1===l?"default":!1===e||!1===y?"pointer":NG(u);const v=(f-g)/(n-i)*p,b=lB(Object.assign({x:u?(g-i)/(n-i)*p:0,y:u?0:(g-i)/(n-i)*p,width:u?v:r,height:u?s:v,cursor:_},a));b.name=HG.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return dB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":NG(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),cB(f)}_bindEvents(){const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),d(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===HG.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===HG.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===HG.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===HG.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new UM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};VG.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class WG extends LG{constructor(t){super(L({},WG.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function UG(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}WG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class GG extends LG{constructor(t){super(L({},GG.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y,sizeBackground:_}=this.attribute,v=rB({x:0,y:0});this._innerView.add(v);const b=new VG({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:UG(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=oB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}GG.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};let YG=class t extends qW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,P,R,B,I,D,L,O,F,z,H,j,N,V,W,U,G,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:mt,minHeight:yt,maxHeight:_t,align:vt,verticalAlign:bt,padding:xt=0}=this.attribute,St=We(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&c(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else c(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(h=null==ct?void 0:ct.maxLineWidth)&&void 0!==h?h:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&c(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(m=ut.y)&&void 0!==m?m:At,width:null!==(_=null!==(y=ut.width)&&void 0!==y?y:pt)&&void 0!==_?_:0,height:null!==(b=null!==(v=ut.height)&&void 0!==v?v:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else c(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(c(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),c(gt)&&(Et=gt),c(ft)&&Ttmt&&(Tt=mt)),c(yt)&&Et_t&&(Et=_t)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],c(vt)||c(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:vt,e=null!==(O=null==ct?void 0:ct.width)&&void 0!==O?O:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","left")):"center"===t?(null===(H=this._mainTitle)||void 0===H||H.setAttribute("x",e/2),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(U=this._mainTitle)||void 0===U||U.setAttribute("textBaseline","top")):"middle"===t?(null===(G=this._mainTitle)||void 0===G||G.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(c(vt)||c(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:vt,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};YG.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const XG={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};let $G=class extends qW{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(c(i))if(!1!==i.visible){const t=L({},C(XG,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:c(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&b(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&b(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(c(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=N(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=L({},C(XG,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:c(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&b(a)&&this._setAutoFit(a,d,e),e.autoLimit&&b(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;h+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=gU(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",c(i.style.lineHeight)?i.style.lineHeight:s)}}};class KG extends UP{constructor(t){super(t)}}var qG,ZG;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(qG||(qG={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(ZG||(ZG={}));class JG extends qW{constructor(t){super(L({},JG.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},JG.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},JG.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},JG.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},JG.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{h(this._playController)&&(this._playController=new KG(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{h(this._backwardController)&&(this._backwardController=new KG(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{h(this._forwardController)&&(this._forwardController=new KG(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()}))},this._createCustomEvent=t=>{var e;const i=new UM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{const t=this._createCustomEvent(qG.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(qG.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(qG.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(qG.OnBackward);this.dispatchEvent(t)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}JG.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},JG.defaultAttributes={visible:!0,[ZG.Start]:{},[ZG.Pause]:{},[ZG.Backward]:{},[ZG.Forward]:{}};const QG={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},tY=[200,10];var eY,iY;!function(t){t.Default="default",t.Reverse="reverse"}(eY||(eY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(iY||(iY={}));const nY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===eY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===eY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},sY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===eY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===eY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},rY=t=>"top"===t||"bottom"===t;class aY extends qW{constructor(t){super(L({},aY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;b(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Pt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:b(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(rY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:tY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:tY[1];s.layout="vertical",s.railWidth=e,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new VG(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return rY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new JG(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=rY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:tY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=v(i)?i:Pt(i[0],i[1]);return t+e.space+n}),0),l=(rY(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:rY(this._orient)?t+n:(this._size.width-r)/2,y:rY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:rY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:rY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:rY(this._orient)?t+n:(this._size.width-r)/2,y:rY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){var i;const n=new UM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}aY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},QG),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},QG),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},QG),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},QG),{key:"backward",position:"start"})}};class oY extends aY{constructor(t){super(L({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:eY.Default,this._dataIndex=h(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(qG.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(qG.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(qG.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(qG.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(iY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(nY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||sY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===eY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(iY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(iY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(iY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),pj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(iY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,pj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(iY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(iY.OnChange),this.dispatchCustomEvent(iY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(iY.OnChange),this.dispatchCustomEvent(iY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var lY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class hY extends aY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(qG.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(qG.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(qG.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(qG.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,n=i/this._maxIndex;this._elapsed=n*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)}))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(iY.OnChange))},this.play=()=>lY(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(iY.OnPlay),this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=pj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,pj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(iY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,pj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(iY.OnPause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(iY.OnBackward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(iY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const cY={debounce:gt,throttle:ft};let dY=class t extends qW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",cY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(De(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=pB(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return L(t,...i,{shape:s.every(h)?void 0:L({},...s),key:r.every(h)?void 0:L({},...r),value:a.every(h)?void 0:L({},...a)})},pY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},gY={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:cU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Wt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},fY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let mY=class t extends qW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=We(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",L({symbolType:"circle"},d.shape,{visible:QW(d)&&QW(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:QW(d)&&QW(d.value)},pY(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:QW(d)&&QW(d.value)},d.value),"text");const u=QW(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-h[3]-h[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const m=QW(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+m);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!QW(l))return;const h=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let u=0;if(QW(l.shape)&&d.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),QW(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},pY(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(QW(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},pY(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";c(l.value.textAlign)?e=l.value.textAlign:QW(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>fY.includes(t)))?(this._mergeAttributes(e,n),h(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&QW(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=QW(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=pU(u),v=pU(p);let b=0;if(QW(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(QW(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&VP[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return uY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return uY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};mY.defaultAttributes=gY;const yY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class _Y extends $W{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=f(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}DV(iV.lineAxis,((t,e)=>new oG(t,e))),DV(iV.circleAxis,(t=>new cG(t)));class vY extends _Y{constructor(t,e,i){super(t,tV.axis,e),this.spec.componentType=tV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=L({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=IV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=fV(s,e,i,n);const c=ON(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=ON(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=ON(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case iV.lineAxis:return((t,e,i)=>{var n,s;const r=yY.axis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p);case iV.circleAxis:return((t,e,i)=>{var n,s;const r=yY.circleAxis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(h(e)){const i=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?iV.circleAxis:iV.lineAxis,this._axisComponentType}}DV(nV.discreteLegend,(t=>new zG(t))),DV(nV.colorLegend,(t=>new WG(t))),DV(nV.sizeLegend,(t=>new GG(t)));class bY extends _Y{constructor(t,e){super(t,tV.legend,e),this.spec.componentType=tV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==nV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":IG.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=f(t)?this.view.getDataById(t):t,l=f(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,eV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=IV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=fV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case nV.discreteLegend:return((t,e)=>{const i=yY.discreteLegend;return t?L({},i,{items:Array.from(new Set(N(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=jN(n),r=s?Object.assign(Object.assign({},yY.discreteLegend.items[0].shape),{fill:s,stroke:s}):yY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):L({},i,null!=e?e:{})})(o,a);case nV.colorLegend:return((t,e)=>{const i=yY.colorLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{colors:t.range().slice(),min:n[0],max:V(n)},null!=e?e:{})})(o,a);case nV.sizeLegend:return((t,e)=>{const i=yY.sizeLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&Fl(i)){const t=e.getScale().range();jN(null==t?void 0:t[0])?this._legendComponentType=nV.colorLegend:this._legendComponentType=nV.sizeLegend}else this._legendComponentType=nV.discreteLegend}return this._legendComponentType}}DV(sV.lineCrosshair,(t=>new _U(t))),DV(sV.rectCrosshair,(t=>new vU(t))),DV(sV.sectorCrosshair,(t=>new xU(t))),DV(sV.circleCrosshair,(t=>new bU(t))),DV(sV.polygonCrosshair,(t=>new SU(t)));const xY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(Hl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Yt(Kt(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else Fl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Kt(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class SY extends _Y{constructor(t,e){super(t,tV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case sV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=yY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return L({},l,xY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case sV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=yY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=xY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=L({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case sV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=yY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(Hl(e.type)){const i=Yt(Kt(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else Fl(e.type)&&(f=Kt(u,t));return L({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case sV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=yY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(Hl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else Fl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return L({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case sV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=yY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(Hl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else Fl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return L({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=tV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=IV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=fV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?sV.sectorCrosshair:sV.rectCrosshair:"radius"===n?sV.circleCrosshair:"radius-polygon"===n?sV.polygonCrosshair:sV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}DV(tV.slider,(t=>new VG(t)));class wY extends $W{constructor(t,e){super(t,tV.slider,e),this.spec.componentType=tV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=f(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=f(t)?this.view.getDataById(t):t,a=f(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,eV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>L({},yY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(h(this.spec.min)?0:ON(this.spec.min,i,t,e),h(this.spec.max)?1:ON(this.spec.max,i,t,e),fV(n,t,e,i))}),e}),{});this._encoders=e}}DV(tV.label,(t=>new VU(t)));let AY=class extends $W{constructor(t,e){super(t,tV.label,e),this.spec.componentType=tV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=ON(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=yY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case QN.line:r=yY.lineLabel;break;case QN.rect:r=yY.rectLabel;break;case QN.symbol:r=yY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[_V],n=fV(i,e.getDatum(),e,s),o=L({},r.data[0],n);a.push(o)}}));const o=ON(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return L({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!h(t)));return L({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};DV(tV.datazoom,(t=>new gG(t)));class kY extends $W{constructor(t,e){super(t,tV.datazoom,e),this.spec.componentType=tV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!h(this.spec.preview)){const t=this.spec.preview.data,e=f(t)?this.view.getDataById(t):t;this.detach(e),this.detach(WN(this.spec.preview.x,this.view)),this.detach(WN(this.spec.preview.y,this.view)),this.detach(WN(this.spec.preview.x1,this.view)),this.detach(WN(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=f(t)?this.view.getDataById(t):t;this.attach(r),this.attach(WN(e,this.view)),this.attach(WN(i,this.view)),this.attach(WN(n,this.view)),this.attach(WN(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t,c=f(e)?(t,i)=>{if(h(i.start)||h(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,eV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},yY.datazoom,t),n=IV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=f(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=fV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=yY.datazoom;return t?L({},l,{previewData:t,previewXCallback:e?t=>fV({x:e},t,r,a).x:null,previewYCallback:i?t=>fV({y:i},t,r,a).y:null,previewX1Callback:n?t=>fV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>fV({y1:s},t,r,a).y1:null},null!=o?o:{}):L({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=f(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}DV(aV.continuousPlayer,(t=>new hY(t))),DV(aV.discretePlayer,(t=>new oY(t)));let MY=class extends $W{constructor(t,e){super(t,tV.player,e),this.spec.componentType=tV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=m(t)?null:f(t)?this.view.getDataById(t):t;this.detach(e)}const r=m(e)?null:f(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=f(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(iY.OnChange,this._filterCallback),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t;return this._filterData(o,l,eV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(iY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=L({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:IV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=fV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=m(o)?null:f(o)?this.view.getDataById(o):o,h=m(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>L({},yY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>L({},yY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};DV(tV.tooltip,(t=>new mY(t)));let CY=class extends $W{constructor(t,e){super(t,tV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ft(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Wt).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>L({},yY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=tV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!h(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=fV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return N(t).reduce(((t,e)=>(t=t.concat(DN(e.visible,this.view)),VN(e.key)||(t=t.concat(DN(e.key,this.view))),VN(e.value)||(t=t.concat(DN(e.value,this.view))),VN(e.symbol)||(t=t.concat(DN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=ON(t.visible,n,e,i);return o=!!h(o)||!!o,s=VN(t.key)?ol(t.key.field)(e):ON(t.key,n,e,i),s=h(s)?void 0:u(s)?s:{text:s},r=VN(t.value)?ol(t.value.field)(e):ON(t.value,n,e,i),r=h(r)?void 0:u(r)?r:{text:r},a=VN(t.symbol)?ol(t.symbol.field)(e):ON(t.symbol,n,e,i),a=h(a)?void 0:u(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?N(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var TY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class EY extends MW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],h(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=DN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];N(t.source).forEach((t=>{const i=zN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return TY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return h(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return h(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=N(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=EW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=EW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(N(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=N(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function PY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function RY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,PY(t,e,s,n)}class BY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return PY(this.nodes,e,0,this.compare),RY(this.nodes,e,null,this.compare)}return this.nodes.push(t),PY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),PY(this.nodes,e,0,this.compare),RY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,RY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class IY{constructor(t){this.list=[],this.ids={},this.idFunc=t||ll}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var DY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class LY{constructor(){this.grammars=[],this.logger=Ve.getInstance(),this._curRank=0,this._committed=new IY((t=>t.uid)),this._heap=new BY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return DY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>h(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new IY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return DY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const OY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===QN.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class FY{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(lV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return PT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Wk.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(lV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Mj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(lV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(lV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(lV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new ZM(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=d(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new tC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class zY extends MW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?ON(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(m(t)&&m(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function $Y(t,e,i){ON(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=ON(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),h(null==n?void 0:n.clamp)||(l(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function KY(t,e,i){GY(t,e,i),YY(t,e,i),XY(t,e,i),$Y(t,e,i)}function qY(t,e,i){t.round&&e.round(ON(t.round,i,e),!0),t.padding&&e.padding(ON(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(ON(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(ON(t.paddingOuter,i,e),!0),t.align&&e.align(ON(t.align,i,e),!0)}function ZY(t,e,i,n){const s=t.field,r=FN(t.data,i),a=f(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),Fl(e.type)?(n&&a.filter((t=>v(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function JY(t,e,i){if(jY(t.domain)?e.domain(ZY(t.domain,e,i,!0),!0):e.domain(ON(t.domain,i,e),!0),jY(t.range))e.range(ZY(t.range,e,i),!0);else if(NY(t.range)){const n=FN(t.range.coordinate,i);!function(t){switch(t){case Ol.Quantile:case Ol.Quantize:case Ol.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(ON(t.range,i,e),!0);switch(t.type){case"linear":KY(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){qY(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){KY(t,e,i);const n=ON(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){GY(t,e,i),XY(t,e,i),$Y(t,e,i);const n=ON(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){KY(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){KY(t,e,i);const n=ON(t.constant,i,e);b(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){GY(t,e,i),XY(t,e,i),$Y(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){GY(t,e,i),YY(t,e,i),XY(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class QY extends MW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=HY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=HY(this.spec.type)),JY(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return h(this.spec.domain)||this.detach(WY(this.spec.domain,this.view)),this.spec.domain=t,this.attach(WY(t,this.view)),this.commit(),this}range(t){return h(this.spec.range)||this.detach(WY(this.spec.range,this.view)),this.spec.range=t,this.attach(WY(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!h(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!h(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return h(e)?null:this.parameters()[e]}configure(t){return this.detach(UY(this.spec.type,t,this.view)),h(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(UY(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let tX=-1;const eX=[zW,HW,VW,jW,NW,WW,UW],iX=t=>{var e,i,n,s;return v(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},nX=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:PV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:CV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:MV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:EV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},sX=(t,e)=>(null==e?void 0:e.debounce)?gt(t,e.debounce):(null==e?void 0:e.throttle)?ft(t,e.throttle):t,rX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:LW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):FV[t]?(i.markType=t,i.source=e):i.source=t===DW?DW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},aX={},oX=()=>aX;let lX=class extends XW{constructor(t,e){super(t,QN.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return cV.rect}evaluateJoin(t){return super.evaluateJoin(SV)}};function hX(t,e){if(b(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return b(t)?t*e:0}return 0}function cX(t,e){return Math.min(t<0?t+e:t-1,e)}function dX(t,e,i){let n=cX(t,i),s=cX(e,i);if(b(t)||b(e)?b(t)?b(e)||(n=cX(Math.max(0,s-1),i)):s=cX(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const uX=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>hX(t,i))),u=l.map((t=>hX(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=dX(e,i,r),{start:h,end:c}=dX(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},pX=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=fl(r.maxChildWidth,s.width()),o=fl(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=iX(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==QN.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(l(r))r.call(null,t,s,a,e);else if(l(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=pX(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(jW,o),i.updateSignal(NW,l),i.updateSignal(VW,h)}else pX(t,s,a,e);else"grid"===r.display&&uX(t,s,a);gX(s,e,i)}))};class fX extends XW{constructor(t,e,i){super(t,QN.glyph,i),this.glyphType=e,this.glyphMeta=YN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=HV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let mX=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return h(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return h(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return m(t)?(i.x=t[0],i.y=t[1]):v(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new qt,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class yX extends mX{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=h(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=h(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=m(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class _X extends mX{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Yt(s);const r=rt(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function vX(t){switch(t){case"cartesian":default:return new yX;case"polar":return new _X}}class bX extends MW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=vX(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=vX(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,c;!h(t.start)&&e.start(null!==(n=ON(t.start,i))&&void 0!==n?n:[0,0]),!h(t.end)&&e.end(null!==(s=ON(t.end,i))&&void 0!==s?s:[0,0]),!h(t.origin)&&e.origin(null!==(r=ON(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!h(t.translate)){const e=ON(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!h(t.rotate)){const e=ON(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!h(t.scale)){const e=ON(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}h(t.transpose)||ON(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const xX=Symbol.for("key");class SX{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new hW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i[0]}):h(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(lW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==QN.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==QN.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=lW(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=lW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!h(e.morphElementKey)){const i=HN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new hW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i}):h(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(lW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:xX})),r=lW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:xX}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==xX){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=ON(i.animation.delay,s,o,l),d=ON(i.animation.duration,s,o,l),u=ON(i.animation.oneByOne,s,o,l),p=ON(i.animation.splitPath,s,o,l),g=b(u)&&u>0?t=>v(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?bT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xT)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);mT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?bT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>uT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>gT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:kA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new fT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:gC,null!==(l=i.easing)&&void 0!==l?l:fC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:kA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new yT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:gC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:fC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):mT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class wX{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=f(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),h(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),h(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),h(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),h(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class AX{constructor(t){this.view=t}stop(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.stop()})),this}pause(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.pause()})),this}resume(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.resume()})),this}enable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.enable()})),this}disable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.disable()})),this}enableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.enableAnimationState(t)})),this}disableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.disableAnimationState(t)})),this}animate(){return this.view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){}}class kX extends XW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=LN(e)?null:Object.keys(e).reduce(((t,n)=>(NN(e[n])&&(t[n]=FN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=fV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===Ol.Band){if(!h(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===Ol.Band){if(!h(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:cV.rect}addGraphicItem(t,e){const i=zV(this,this.coord&&"polar"===this.coord.output().type?QN.arc:QN.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class MX extends XW{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=LN(e)?null:Object.keys(e).reduce(((t,n)=>(NN(e[n])&&(t[n]=FN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=fV(e,t,i,s);if(h(r.size)){const t=n.x?mV(n.x):void 0,e=n.y?mV(n.y):void 0;h(t)&&h(e)?r.size=10:h(t)?r.size=e:h(e)&&(r.size=t),r.size=[t,e]}return h(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(v(i.padding)&&i.padding>0)t.size=m(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(m(i.padding)&&2===i.padding.length){const e=m(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(cV.symbol)}release(){super.release(),this._encoders=null}}var CX=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class TX extends r{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[_V],s=GW(0,t,n,e,LW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){f(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new zY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new EY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new QY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new bX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=f(e)?this.getMarkById(e):e;let s;switch(t){case QN.group:s=new lX(this,n);break;case QN.glyph:s=new fX(this,null==i?void 0:i.glyphType,n);break;case QN.component:s=((t,e,i,n)=>{switch(e){case tV.axis:return new vY(t,i,n);case tV.legend:return new bY(t,i);case tV.crosshair:return new SY(t,i);case tV.slider:return new wY(t,i);case tV.label:return new AY(t,i);case tV.datazoom:return new kY(t,i);case tV.player:return new MY(t,i);case tV.tooltip:return new CY(t,i)}return new $W(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case QN.interval:s=new kX(this,t,n);break;case QN.cell:s=new MX(this,t,n);break;default:s=new XW(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(QN.group,t)}glyph(t,e){return this.mark(QN.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(QN.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(QN.component,t,{componentType:tV.axis,mode:e})}legend(t){return this.mark(QN.component,t,{componentType:tV.legend})}crosshair(t){return this.mark(QN.component,t,{componentType:tV.crosshair})}slider(t){return this.mark(QN.component,t,{componentType:tV.slider})}label(t){return this.mark(QN.component,t,{componentType:tV.label})}datazoom(t){return this.mark(QN.component,t,{componentType:tV.datazoom})}player(t){return this.mark(QN.component,t,{componentType:tV.player})}tooltip(t){return this.mark(QN.component,t,{componentType:tV.tooltip})}customized(t,e){const i=(t=>aX[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=f(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&eX.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(lV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++tX;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(zW,t.width),this.updateSignal(HW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=oX();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(lV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=oV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:zW,value:null!==(i=t[zW])&&void 0!==i?i:0},{id:HW,value:null!==(n=t[HW])&&void 0!==n?n:0},{id:VW,value:iX(null!==(s=t[VW])&&void 0!==s?s:e[VW])},{id:jW,update:{callback:(t,e)=>{const i=iX(e[VW]);return e[zW]-i.left-i.right},dependency:[zW,VW]}},{id:NW,update:{callback:(t,e)=>{const i=iX(e[VW]);return e[HW]-i.top-i.bottom},dependency:[HW,VW]}},{id:WW,update:{callback:(t,e)=>{const i=iX(e[VW]);return(t||new Vt).setValue(i.left,i.top,i.left+e[jW],i.top+e[NW])},dependency:[jW,NW,VW]}},{id:UW,value:null!==(r=t[UW])&&void 0!==r?r:e[UW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===QN.glyph?{glyphType:t.glyphType}:t.type===QN.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(zW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(HW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(jW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(NW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(VW);if(arguments.length){const i=iX(t);return this.updateSignal(e,i),i}return iX(e.output())}autoFit(t){const e=this.getSignalById(UW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(WW);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=oV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===QN.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||gX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(lV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(lV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(lV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{OY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(lV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(lV.BEFORE_MARK_RENDER_END),OY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(lV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return CX(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return CX(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(lV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(lV.AFTER_DO_RENDER)}evaluate(t){var e,i;return CX(this,void 0,void 0,(function*(){const n=nX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=oV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=oV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=oV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=nX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=oV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=oV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=oV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!eX.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return OY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=tn(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return CX(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(zW,t)),e!==this.height()&&(n=!0,this.updateSignal(HW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,c=rX(e);if(!c)return;const{source:u,type:p}=c,g=h((v=c).markId)?t=>t&&t.mark.id()===v.markId:h(v.markName)?t=>t&&t.mark.name()===v.markName:h(v.type)?t=>t&&t.mark.markType===v.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:f(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),y=IN(l,this),_=sX(((t,e)=>{const n=u===LW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===DW&&(t=GW(0,t,e,p,DW));let s=!1;if((!i||i(t))&&(!g||g(e))&&m.length){const e=y.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var v;if(u===LW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||d(n)&&!n[i])}(this._eventConfig,LW,p))return this.addEventListener(p,_,OW),()=>{this.removeEventListener(p,_)}}else if(u===DW)return pj.addEventListener(p,_),this._eventListeners.push({type:p,source:pj,handler:_}),()=>{pj.removeEventListener(p,_);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===pj&&t.handler===_));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);f(e)?i.type=e:d(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:FW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?f(r)?r:r.user:FW,o=r&&a===r.user&&(s===r.element||h(s)&&h(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==FW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!h(document)&&document.body:this.container;return e?h(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new FY(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new wX((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new wX((t=>t.id())),this._options.logger&&Ve.setInstance(this._options.logger),this.logger=Ve.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new LY,this.animate=new AX(this),this._morph=new SX,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{m(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[LW,DW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&pj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=oV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==QN.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=pj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&pj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),TN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const EX=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{CN(e,t[e],!0)}))}))};EX(yV);const PX=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var RX,BX,IX;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(RX||(RX={})),function(t){t.chart="chart",t.window="window"}(BX||(BX={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(IX||(IX={}));const DX=`${$j}_waterfall_default_seriesField`,LX=`${$j}_DEFAULT_DATA_INDEX`,OX=`${$j}_DEFAULT_DATA_KEY`,FX=`${$j}_DEFAULT_DATA_SERIES_FIELD`,zX=`${$j}_DEFAULT_SERIES_STYLE_NAME`;var HX;!function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.Built_In=99]="Built_In"}(HX||(HX={}));const jX=`${$j}_STACK_START`,NX=`${$j}_STACK_END`,VX=`${$j}_STACK_START_PERCENT`,WX=`${$j}_STACK_END_PERCENT`,UX=`${$j}_STACK_START_OffsetSilhouette`,GX=`${$j}_STACK_END_OffsetSilhouette`,YX=`${$j}_SEGMENT_START`,XX=`${$j}_SEGMENT_END`;var $X,KX;!function(t){t[t.Axis_Grid=100]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark"}($X||($X={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(KX||(KX={}));const qX=["linear","radial","conical"],ZX={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},JX={innerRadius:0,outerRadius:1,startAngle:SN,endAngle:wN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var QX,t$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(QX||(QX={})),function(t){t.middle="middle",t.start="start",t.end="end"}(t$||(t$={}));const e$={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,tickSize:Bj,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Bj/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Pj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Pj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},i$={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Pj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},n$={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Pj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},s$={name:"light",padding:12,fontFamily:Ej,colorScheme:{default:{dataScheme:[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Pj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Pj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Gj,line:jj,area:Ij,bar:Dj,bar3d:Lj,pie:Vj,pie3d:Wj,map:Nj,radar:Uj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:Oj,funnel3d:Fj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:Yj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:Hj,treemap:Xj,sunburst:JX,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Pj},minLabel:{position:t$.end},maxLabel:{position:t$.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Pj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Pj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...n$,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...n$,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...n$},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...n$}},axis:e$,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10},maxHeight:"30%"},axisY:{label:{space:20},title:{space:20,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Pj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Pj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!1,background:{size:5,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:8,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:i$,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Rj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Pj,lineHeight:Rj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Pj,fontFamily:Ej}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Pj,fontFamily:Ej}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}}}},r$=new Map([[s$.name,s$]]),a$=s$.name;class o${static instances=new Map;static registerInstance(t){o$.instances.set(t.id,t)}static unregisterInstance(t){o$.instances.delete(t.id)}static getInstance(t){return o$.instances.get(t)}static instanceExist(t){return o$.instances.has(t)}static forEach(t,e=[],i){const n=N(e);return o$.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class l${static themes=new Map;static _currentThemeName=a$;static registerTheme(t,e){t&&l$.themes.set(t,L({},l$.getDefaultTheme(),e))}static getTheme(t){return l$.themes.get(t)||l$.getDefaultTheme()}static removeTheme(t){return l$.themes.delete(t)}static themeExist(t){return l$.themes.has(t)}static getDefaultTheme(){return l$.themes.get(a$)}static setCurrentTheme(t){l$.themeExist(t)&&(l$._currentThemeName=t,o$.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return l$.getTheme(l$._currentThemeName)}static getCurrentThemeName(){return l$._currentThemeName}}l$.registerTheme(a$,r$.get(a$)),r$.forEach(((t,e)=>{e!==a$&&l$.registerTheme(e,t)}));const h$=(t,e,i)=>new ze({defaultFontParams:{fontFamily:Tj,fontSize:14},getTextBounds:i?void 0:yB,specialCharSet:"-/: .,@%'\"~"+ze.ALPHABET_CHAR_SET+ze.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),c$=gB({});function d$(t,e){for(let i=0;it.key===e))}function p$(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const g$=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;s{M(t.state[e])||(t.state[e]=_$(t.state[e]))})),t}function y$(t){return M(t)?null:(Object.keys(t).forEach((e=>{M(t[e])||(t[e]=_$(t[e]))})),t)}function _$(t){return M(t)||t.angle&&(t.angle=Ut(t.angle)),t}var v$;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(v$||(v$={}));class b${static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Ja,fields:eo,filter:un,fold:to};static dataParser={csv:go,dsv:po,tsv:fo};static _layout={};static registerChart(t,e){b$._charts[t]=e}static registerSeries(t,e){b$._series[t]=e}static registerComponent(t,e){b$._components[t]=e}static registerMark(t,e){b$._marks[t]=e}static registerRegion(t,e){b$._regions[t]=e}static registerTransform(t,e){b$.transforms[t]=e}static registerLayout(t,e){b$._layout[t]=e}static createChart(t,e,i){if(!b$._charts[t])return null;return new(0,b$._charts[t])(e,i)}static createRegion(t,e,i){if(!b$._regions[t])return null;return new(0,b$._regions[t])(e,i)}static createSeries(t,e,i){if(!b$._series[t])return null;return new(0,b$._series[t])(e,i)}static createMark(t,e,i){if(!b$._marks[t])return null;const n=new(0,b$._marks[t])(e,i);return n.type===v$.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(b$._components)}static getComponentInKey(t){return b$._components[t]}static getLayout(t){return b$._layout[t]}static getSeries(t){return b$._series[t]}}const x$=(t,e,i)=>{const n=t.getRegionsInIds(N(e.layoutBindRegionID));return n?.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},S$=(t,e)=>t===e||!h(t)&&!h(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),w$=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},A$="monotone",k$="linearClosed";var M$;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(M$||(M$={}));var C$;function T$(t){return"bottom"===t||"top"===t}function E$(t){return"left"===t||"right"===t}function P$(t){return"z"===t}function R$(t,e){return Uh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(C$||(C$={}));const B$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&x$(t,n,i)));return n.length?n:null},I$=t=>t.fieldX[0],D$=t=>t.fieldY[0],L$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=O$(t,n,"x",I$);e&&o.push(e)})),a&&a.forEach((t=>{const e=O$(t,s,"y",D$);e&&o.push(e)})),o.length?o:null},O$=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return F$(t,a,n)},F$=(t,e,i)=>{const n=t.getScale();if(!n||!Hl(n.type))return null;if(h(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=w$(e,t,"cartesian",i??(T$(t.orient)?I$:D$));return{index:s,value:e,axis:t,data:r}},z$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&x$(t,n,i)));return n.length?n:null},H$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&Hl(e.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=Bl({x:1,y:0},d);u=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(u,r);const p=Il(d),g=a[0]?.getScale(),f=g?.range();if((u-r?.[0])*(u-r?.[1])>0||(p-f?.[0])*(p-f?.[1])>0)return;const m=Math.abs(r[0]-r[1])/i.length/2,y=e.invert(u+m);if(h(y))return;let _=e.domain().findIndex((t=>t?.toString()===y.toString()));_<0&&(_=void 0);const v=w$(y,t,"polar",l);o.push({index:_,value:y,axis:t,data:v})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&Hl(e.type)){const a=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let d=Bl({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const u=Il(c),p=r[0]?.getScale(),g=p?.range();if((d-g?.[0])*(d-g?.[1])>0||(u-i?.[0])*(u-i?.[1])>0)return;const f=e.invert(u);if(h(f))return;let m=e.domain().findIndex((t=>t?.toString()===f.toString()));m<0&&(m=void 0);const y=w$(f,t,"polar",l);o.push({index:m,value:f,axis:t,data:y})}})),o.length?o:null};class j${_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=L$(this._chart,{x:t,y:e})??[],n=H$(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!Hl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=F$(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var N$;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(N$||(N$={}));const V$={[N$.dimensionHover]:class extends j${_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:BX.chart},callback:this.onMouseMove}),Zo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:BX.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Zo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!S$(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[N$.dimensionClick]:class extends j${constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:BX.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let W$=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(V$[t]){const e=new V$[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(V$[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class U${_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(IX.vchart,[]),this._levelNodes.set(IX.chart,[]),this._levelNodes.set(IX.model,[]),this._levelNodes.set(IX.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const G$={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class Y${globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||BX.chart),n=this.getEventListeners(e.filter?.source||BX.chart);i.get(t)||i.set(t,new U$);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||BX.chart),s=this.getEventListeners(e?.filter?.source||BX.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||BX.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||BX.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(IX.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(IX.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(IX.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(IX.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(BX.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(BX.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if(l(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&C(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return G$[n]&&(n=G$[n]),(!t.type||n===t.type)&&(!c(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=c(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=c(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&c(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();c(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:C(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:c(t.id)?IX.model:IX.vchart:IX.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ft(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=gt(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=BX.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==IX.model&&i!==IX.mark||(n=e.type),e?.source&&(s=e.source),c(e?.id)&&(o=e?.id,i=IX.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case BX.chart:return this._viewBubbles;case BX.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case BX.chart:return this._viewListeners;case BX.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return PX.includes(t)||Object.values(lV).includes(t)||Object.values(RX).includes(t)}}function X$(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function $$(t,e,i){t.getParser(e)||t.registerParser(e,i)}const K$=new Map;let q$;function Z$(t,e,i={type:"geojson",centroid:!0}){K$.has(t)&&Go(`map type of '${t}' already exists, will be overwritten.`),q$||(q$=new Ho,$$(q$,"geojson",Io),$$(q$,"topojson",Lo),X$(q$,"simplify",Ja));const n=new No(q$),s=L({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),K$.set(t,n)}function J$(t,e=!1){let i=e;return t.latestData instanceof No&&(i=!1),i?R(t.latestData):t.latestData.slice()}const Q$=(t,e)=>0===t.length?[]:1===t.length?J$(t[0],e?.deep):t.map((t=>J$(t,e?.deep)));function tK(t,e,i){X$(e=e instanceof Ho?e:t.dataSet,"copyDataView",Q$);const n=new No(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function eK(t,e,i=[]){if(t instanceof No)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new No(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!f(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Yo("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const iK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)}}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!f(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&pj.getCancelAnimationFrame()(this._rafId),this._rafId=pj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===BX.chart){const n=function(n,s){const r=s?.mark?.context??{},a=c(r.modelId)?r.modelId:null,o=c(r.markId)?r.markId:null,l=c(r.modelUserId)?r.modelUserId:null,h=c(r.markUserId)?r.markUserId:null,d={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,d)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===BX.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===BX.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===BX.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(h(e))return;const i=e.id(),n=t.grammarType;h(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(h(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];c(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return c(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return qo(this._option.mode)?globalThis:this.getStage()?.window}}async function cK(t){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){console.error("getCanvasDataURL",t)}return t.toDataURL()}class dK{id=tl();static useChart(t){t.forEach((t=>b$.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>b$.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>b$.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>b$.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>b$.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){b$.registerTransform(t,e)}static registerMap(t,e,i){Z$(t,e,i)}static unregisterMap(t){!function(t){K$.has(t)?K$.delete(t):Go(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,K$.get(e);var e}static hideTooltip(t=[]){o$.forEach((t=>t?.hideTooltip?.()),t)}static InstanceManager=o$;static ThemeManager=l$;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=L(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,...a}=this._option;i&&(this._container=f(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=l$.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new hK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,...a,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new Y$(this,this._compiler),this._event=new W$(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!qo(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(RX.initialized,{}),o$.registerInstance(this)):Yo("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=Zh(f(t)?JSON.parse(t):t))}_initData(){if(h(this._dataSet))return void Go("dataSet is not initialized");const t=N(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Yo("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=gt(((...t)=>{const{width:e,height:i}=tn(this._container,Kj,qj),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof Ho?t:new Ho,$$(this._dataSet,"dataview",Oo),$$(this._dataSet,"array",hn),X$(this._dataSet,"stackSplit",iK),X$(this._dataSet,"copyDataView",Q$);for(const t in b$.transforms)X$(this._dataSet,t,b$.transforms[t]);for(const t in b$.dataParser)$$(this._dataSet,t,b$.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return c(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)}))),this._event.emit(RX.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(nK.update,!0)}))),this._event.emit(RX.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),K$.clear(),q$=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,o$.unregisterInstance(this)}async updateData(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):m(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new No(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new No(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(f(t)&&(t=JSON.parse(t)),e&&(t=L({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=Zh(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}_updateCurrentTheme(){f(this._spec?.theme)?(this._currentTheme=L({},l$.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=L({},l$.getTheme(this._currentThemeName),this._spec?.theme??{})}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return l$.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===dn.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(c(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===dn.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===dn.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===dn.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await cK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!qo(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(c(this._container))return this._container;let t;return t=f(this._canvas)?document?.getElementById(this._canvas):this._canvas,c(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(M(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),qh(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||h(t)||M(e))return null;if(!m(t)){const{axisId:n,axisIndex:s}=e;let r;if(c(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):c(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Go("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?qh(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Go("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(rK||(rK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aK||(aK={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(oK||(oK={}));class uK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){h(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,L({},uK.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return[...this._children]}getMarksInType(t){const e=N(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}class pK{event;interaction;_option;_marks=new uK;_markReverse=new uK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){M(t.stateStyle[rK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),M(t.stateStyle[rK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(N$.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=m(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(rK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(rK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(rK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(rK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(rK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class gK{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class fK extends gK{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=KX.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=$h(Kh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=h(t.minHeight)?null:Xh(t.minHeight,e.height,e),this._maxHeight=h(t.maxHeight)?null:Xh(t.maxHeight,e.height,e),this._minWidth=h(t.minWidth)?null:Xh(t.minWidth,e.width,e),this._maxWidth=h(t.maxWidth)?null:Xh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Xh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Xh(t.height,e.height,e)},{height:9}),h(t.offsetX)||(this.layoutOffsetX=Xh(t.offsetX,e.width,e)),h(t.offsetY)||(this.layoutOffsetY=Xh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{h(this._spec[i])||(e[i]=Xh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};h(n)||(r.width-=n),h(s)||(r.width-=s),h(e)||(r.height-=e),h(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(h(n)?h(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,h(e)?h(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){b(t)&&(this._layoutStartPoint.x=t),b(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){b(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),b(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}_setRectInSpec(t){const e={...t};return this._layoutRectLevelMap.width<9?(h(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),h(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(h(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),h(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class mK extends gK{grammarType;id=tl();_product;getProduct(){if(c(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return c(e)&&c(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){c(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(c(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(c);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class yK extends mK{grammarType=sK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}c(this._value)&&this._product.value(this._value),c(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class _K extends gK{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new yK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class vK extends _K{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(L(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class bK extends vK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class xK extends fK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new uK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=tl(),this._originalSpec=t,this._spec=Jh(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new W$(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new bK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Jh(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(h(t)||h(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=L({},e?.[N(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),m(t))return t.map((t=>d(t)&&!l(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];d(n)&&!l(n)&&(Oh(n)?e[i]=Lh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){c(t)&&c(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!c(t)||!c(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${$j}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=b$.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const SK={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",rectRound:"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"},wK={symbol:function(t,e){return"shape"===t?SK[e]??e:e}};const AK={};Object.values(rK).forEach((t=>{AK[t]=!0}));const kK={[rK.STATE_HOVER]:rK.STATE_HOVER_REVERSE,[rK.STATE_SELECTED]:rK.STATE_SELECTED_REVERSE,[rK.STATE_DIMENSION_HOVER]:rK.STATE_DIMENSION_HOVER_REVERSE};function MK(t){return kK[t]}class CK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!M(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=MK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=MK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=MK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=MK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class TK extends vK{id=tl();stateKeyToSignalName=t=>`${$j}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===nK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===nK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===nK.enter?nK.appear:nK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===nK.enter?nK.appear:nK.none}}}}class EK extends xK{static type="region";modelType="region";type=EK.type;_series=[];layoutType="region";layoutZIndex=$X.Region;animate;interaction=new CK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new TK({getCompiler:e.getCompiler})),c(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:v$.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",HX.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",HX.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:v$.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:v$.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",HX.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex($X.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",HX.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",HX.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",HX.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||N(t.userId).includes(e.userId))&&(!c(t.specIndex)||!e.getSpecIndex||N(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(RX.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new pK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aK)M(t.stateStyle[aK[e]])||this.interaction.registerMark(aK[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class PK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient&&(this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const RK=[v$.line,v$.area,"trail"];function BK(t){return RK.includes(t)}class IK extends vK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];c(n.domain)&&(s.domain=n.domain),c(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=o(BK)?n:!t.mark||BK(t.mark.markType);let s=!1,r=!1;if(c(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!AK[t])).map((t=>[t,10])),n=!t.mark||BK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(m(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith($j)));n=t.datums.some((t=>i&&m(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(d(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith($j)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(Fl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class DK extends mK{grammarType=sK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();h(t)||(h(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class LK extends DK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return c(t)?t:`${$j}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct(t)}}class OK extends mK{grammarType=sK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=$X.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){c(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){h(this._data)&&this.initMarkData({...this._option,mark:this}),c(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new IK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new W$(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new LK(t)}stateKeyToSignalName(t){return`${$j}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(c(e)&&this.removeProduct());if(c(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),h(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(h(this._data))return;this._data.compile();const t=this._data.getProduct();c(this._product)&&c(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[rK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!l(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(lV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===nK.appear&&this.runAnimationByState(nK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),wK[a]?wK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class FK extends OK{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(c(t.id)&&(this._userId=t.id),o(t.interactive)&&(this._interactive=t.interactive),c(t.zIndex)&&this.setZIndex(t.zIndex),o(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(v(t))return xl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(xl)),t}return"function"==typeof t?(e,i,n,s)=>xl(t(e,i,n,s)):t}isUserLevel(t){return[HX.User_Mark,HX.User_Series,HX.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];h(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;c(r)&&r<=n&&L(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(zl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return f(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=jh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;return s=this.stateStyle[i]?.[t]?this._computeStateAttribute(this.stateStyle[i][t],t,e,i,n):this._computeStateAttribute(this.stateStyle.normal[t],t,e,i,n),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,s):s}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):qX.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):zl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",HX.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=l(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,HX.User_Mark,e)}else this.setStyle(i,t,HX.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let h=s,d=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(h=t),d||(d=e)}const u=Ih(Bh(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),p={},g={...ZX[n],...a};return Object.keys(g).forEach((t=>{const n=g[t];"stops"===t?p.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??h?.scale(e[d]);return l(s)&&(a=s(e,this._attributeContext,i,o)),c(n)&&(a=Uo.SetOpacity(a,n)),{offset:l(r)?r(e,this._attributeContext,i,o):r,color:a||u[0]}})):l(n)?p[t]=n(e,this._attributeContext,i,o):p[t]=n})),p.gradient=n,p}_computeThresholdAttr(t){return(new Ch).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class zK extends FK{static type=v$.group;type=zK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Go("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Go("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class HK extends FK{static type=v$.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(QN.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}dK.useMark([HK,zK]),b$.registerRegion("region",EK),b$.registerLayout("base",PK);var jK,NK,VK;Ve.getInstance(Ne.Error),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(jK||(jK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(NK||(NK={}));class WK{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?jh("colorOrdinal"):jh(t.type)),e?(m(t.range)&&e.range(t.range),m(t.domain)&&(il(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),il(n.domain)?e.reRender=!0:z(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{il(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{d$(e,[{key:t,operations:Fl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&d$(e,[{key:i.field,operations:Fl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!il(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=Fl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{Fl(e.type)?(h(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),h(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;Fl(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!h(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(Fl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(Fl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));Fl(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(h(t.field)||!h(t.changeDomain)&&"none"!==t.changeDomain&&!h(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class UK{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(RX.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][NX]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[NX],s>=0?(t[jX]=e,e+=t[NX],t[NX]=e):(t[jX]=i,i+=t[NX],t[NX]=i)})),t.values.forEach((t=>{s=t[NX];const r=s>=0?e:i;n=s>=0?1:-1,t[VX]=Math.min(1,t[jX]/r)*n,t[WX]=Math.min(1,t[NX]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[NX]=function(t){if(b(t))return t;const e=+t;return b(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class GK extends gK{type="chart";id=tl();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:Kj,height:qj};getLayoutRect(){return this._layoutRect}_viewRect={width:Kj,height:qj};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:Kj,y2:qj};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=Kh(t.padding??this._theme?.padding),this._event=new W$(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new UK(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),E(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=b$.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=eK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),c(t.regionId)?i=this.getRegionsInUserId(t.regionId):c(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=b$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&N(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=b$.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(b$.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(RX.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(RX.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>N(t).some((t=>c(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof xK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof FK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof FK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(c(t)&&c(e))this._canvasRect={width:t,height:e};else{let i=Kj,n=qj;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=tn(this._option.container,Kj,qj);i=t,n=e}else if(r&&qo(this._option.mode)){let t;t=f(r)?document?.getElementById(r):r;const{width:e,height:s}=tn(t,Kj,qj);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;if(m(t))e.range=t.map((t=>Lh(t,this._theme?.colorScheme)));else{const i=t;Object.prototype.hasOwnProperty.call(i,"type")&&(e.type=i.type),Object.prototype.hasOwnProperty.call(i,"domain")&&(e.domain=i.domain),Object.prototype.hasOwnProperty.call(i,"range")&&(e.range=i.range),Object.prototype.hasOwnProperty.call(i,"specified")&&(e.specified=i.specified)}}return e.range?.length||(e.range=Bh(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new WK(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Bh(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&N(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};m(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=$h(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(M(t[n]))continue;const s=t[n];let r={stateValue:n};r=l(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rK.STATE_HOVER,!0,t,e,i)}initEvent(){[RX.dataZoomChange,RX.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(lV.AFTER_MARK_RENDER_END,e)};this._event.on(lV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||l(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===N$.dimensionHover||s===N$.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===dn.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===dn.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class YK extends GK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function XK(t){t.crosshair=N(t.crosshair||{}).map((e=>L({[t.direction===Wh.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(VK||(VK={}));const $K=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!h(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!h(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!h(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=c,(h(o)||o===DX)&&(t[DX]=c?l.total:+t[n]>=0?l.increase:l.decrease)})),f={...i,lastIndex:t},d.push(i)})),d},KK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},qK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:ZK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function ZK(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>ZK(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class JK{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new No(e instanceof Ho?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),X$(e,"dimensionTree",qK),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const QK=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},tq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class eq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new uK;_markReverse=new uK;constructor(t,e){this._spec=t,this._option=e,this.event=new W$(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(rK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(rK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(N(i).forEach((e=>{t.on(e,{level:IX.chart},this.onHover)})),n&&"none"!==n&&N(n).forEach((e=>{t.on(e,{level:IX.vchart,source:BX.chart},this.onUnHover)}))),s&&(N(r).forEach((e=>{t.on(e,{level:IX.mark},this.onSelect)})),a&&"none"!==a&&N(a).forEach((e=>{t.on(e,{level:IX.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=tq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;o(i)?this._hover.enable=i:d(i)&&(this._hover.enable=!0,this._hover=L(this._hover,i));const n=this._spec.select;o(n)?this._select.enable=n:d(n)&&(this._select.enable=!0,this._select=L(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,rK.STATE_HOVER)||this.interaction.getEventElement(rK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,rK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(rK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(rK.STATE_HOVER,t.item),this.interaction.reverseEventElement(rK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(rK.STATE_HOVER);this.interaction.clearEventElement(rK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(rK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,rK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(rK.STATE_SELECTED);this.interaction.clearEventElement(rK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(rK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(rK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(rK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(rK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(rK.STATE_SELECTED);const e=this.interaction.getEventElementData(rK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,rK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class iq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const nq=(t,e)=>c(e)?t.map((t=>e[t])):void 0,sq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),rq=t=>!h(t)&&(m(t)?t.length>0&&t.every(c):Object.keys(t).length>0);function aq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(c(s.regionId)?[s.regionId]:void 0,c(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=c(s)?t[s]:void 0,a=c(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=nq(i,t);let d=nq(n,t);const u=rq(d),p=!u&&c(s)&&h(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,c=i.map(((t,e)=>[t,e])).filter((([,t])=>h(l?.[t])));let g=[l??[]];c.length>0&&c.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];g.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),g=s})),g.forEach((l=>{if(p){const r=t.getViewData()?.latestData.filter(sq(i,l));a.forEach((a=>{const c=r.find((t=>t[s]===a));if(d=nq(n,c),!rq(d))return;const p=t.dataToPosition(c);h(p)||isNaN(p.x)||isNaN(p.y)||o.push({pos:p,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===NK.pie){const t=e,a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToCentralPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}else{const t=e;if(p){const c=t.getViewData()?.latestData.filter(sq(i,l)),p=c.find((t=>t[s]===r));a.forEach((r=>{if(d=nq(n,p),!rq(d))return;const a=t.dataToPosition(p);h(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(sq(i,l));if(!u&&(d=nq(n,a),!rq(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),d=r.getLayoutStartPoint(),u=r.getLayoutRect(),p=n.globalInstance.getContainer(),g={x:0,y:0,...p?en(p):{}},f=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>sq(e,i)(t)&&sq(n,s)(t)&&(h(r)||sq([r],[a])(t))));return o},m=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),u.width),y:Math.min(Math.max(t.y,0),u.height)}))(t),i=s.x??d.x+e.x,n=s.y??d.y+e.y;return{canvasX:i,canvasY:n,clientX:g.x+i,clientY:g.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>f(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:BX.chart,event:m({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return dK.globalConfig.uniqueTooltip&&dK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...f(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:BX.chart,event:m(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return dK.globalConfig.uniqueTooltip&&dK.hideTooltip(a.id),l}return"none"}const oq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return c(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function lq(t){return h(t.mark)&&h(t.model)&&h(t.datum)}class hq extends iq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];c(i)&&(e[t]={...i,title:c(i.title)?l(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:c(i.content)?l(i.content)?i.content:N(i.content).map((t=>l(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=oq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:c(e)?N(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of N(e)){const e=this.series.getSeriesStyle(t)?.(i);if(c(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const cq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},dq={min:t=>t===cq.min()?0:t,max:t=>t===cq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===cq.min()?0:t,"array-max":t=>t===cq.max()?0:t};const uq={min:function(t,e){return el(e)?Math.min(t,e):t},max:function(t,e){return el(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>el(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>el(t)));return 0===i.length?t:Math.max(t,...i)}},pq=(t,e)=>{const i={};let n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;n=d$([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!h(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=cq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=uq[n](i[t.key][n],s)})),i[t.key][n]=dq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},gq=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>el(t[s])));else if("zero"===n)return t.forEach((t=>{el(t[s])||(t[s]=0)})),t;return t};class fq extends DK{_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const mq=`${$j}_HIERARCHY_DEPTH`,yq=`${$j}_HIERARCHY_ROOT`,_q=`${$j}_HIERARCHY_ROOT_INDEX`,vq=()=>({keyMap:new Map});function bq(t,e,i){t&&(this._seriesField||(t[FX]=this.getSeriesKeys()[0]),t[LX]=e,t[OX]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function xq(t,e,i,n=0,s,r){void 0===r&&(r=e),bq.bind(this)(t,e,i),t[mq]=n,t[yq]=s||t[this.getCategoryField()],t[_q]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>xq.bind(this)(e,n,i,t[mq]+1,t[yq],r)))}class Sq extends xK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[jK.label]:{name:jK.label,type:v$.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([v$.line,v$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(RX.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&c(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(RX.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(h(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),o(this._spec.stack)&&(this._stack=this._spec.stack),o(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),o(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),c(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=tK(this._rawData,this._dataSet,{name:`${$j}_series_${this.id}_viewDataFilter`});const t=tK(this._viewDataFilter,this._dataSet,{name:`${$j}_series_${this.id}_viewData`});this._data=new fq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(X$(this._option.dataSet,"invalidTravel",gq),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new JK(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${$j}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${$j}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){X$(this._dataSet,"dimensionStatistics",pq);const n=new No(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=d$(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&d$(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${$j}_series_${this.id}_viewStackData`;this._viewStackData=new No(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(h(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(f(t))return e[t];if(m(t)&&t.every((t=>f(t))))return t.map((t=>e[t])).join("-");if(l(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(X$(this._rawData.dataSet,"addVChartProperty",QK),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(RX.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(RX.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(RX.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(RX.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(RX.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||h(e)?[]:f(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:v$.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${$j}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${$j}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||h(t.dataId)&&h(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new eq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??FX;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:zX,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,zX)}))}afterInitMark(){this.event.emit(RX.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",HX.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new hq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??FX,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Bh(this._option.getTheme().colorScheme,this.type);return(new zh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??FX}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=L({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:l,dataProductId:d,parent:u,isSeriesMark:p,dataStatistics:g,depend:f,label:m,progressive:y,support3d:_=this._spec.support3d||!!this._spec.zField,morph:v=!1}=e,b=super._createMark(t,{key:i??this._getDataIdKey(),support3d:_,dataStatistics:g??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(c(b)){this._marks.addMark(b),p&&(this._seriesMark=b),h(u)?this._rootMark?.addMark(b):!1!==u&&u.addMark(b),h(l)?(b.setDataView(this.getViewData(),this.getViewDataProductId()),b.setSkipBeforeLayouted(!0)):!1!==l&&b.setDataView(l,d),o(s)&&b.setSkipBeforeLayouted(s),c(f)&&b.setDepend(...N(f)),c(m)&&b.setLabelSpec(m);const t=this.getSpec()||{};b.setMorph(v),b.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),b.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),h(y)||b.setProgressiveConfig(y),h(n)||b.setGroupKey(n),this.initMarkStyleWithSpec(b,L({},r,a||t[b.name]))}return b}_getDataIdKey(){return super._getDataIdKey()??OX}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==NX&&t!==WX&&t!==jX&&t!==VX||(t=this.getStackValueField()),p$(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=b$.getSeries(this.type);return Object.values(t.mark??{})}return t}}class wq extends Sq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=N(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=N(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&N(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=Wh.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&this._fieldX.forEach((e=>{const i={key:e,operations:[]};Fl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&this._fieldY.forEach((e=>{const i={key:e,operations:[]};Fl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};Fl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===Wh.vertical?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction===Wh.vertical?(this.setFieldY(NX),this.setFieldY2(jX)):(this.setFieldX(NX),this.setFieldX2(jX))}setValueFieldToPercent(){this.direction===Wh.vertical?(this.setFieldY(WX),this.setFieldY2(VX)):(this.setFieldX(WX),this.setFieldX2(VX))}setValueFieldToStackOffsetSilhouette(){this.direction===Wh.vertical?(this.setFieldY(GX),this.setFieldY2(UX)):(this.setFieldX(GX),this.setFieldX2(UX))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Wo(t.xField,i)&&Wo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),c(this._spec.direction)&&(this._direction=this._spec.direction),this._direction===Wh.vertical?(this.setFieldY2("y1"),this.setFieldX2(this._spec?.x2Field)):(this.setFieldX2("x1"),this.setFieldY2(this._spec?.y2Field)),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[0]:Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===Wh.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===Wh.vertical?N(this._spec.yField??this.fieldY):N(this._spec.xField??this.fieldX)}}const Aq=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};const kq={type:"clipIn"},Mq={type:"fadeIn"};function Cq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===Wh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Wh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Mq;default:return kq}}function Tq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=i?.[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const Eq=(t,e=!0)=>({type:t.direction===Wh.horizontal?"growWidthIn":"growHeightIn",options:Tq(t,e)}),Pq=(t,e=!0)=>({type:t.direction===Wh.horizontal?"growWidthOut":"growHeightOut",options:Tq(t,e)}),Rq={type:"fadeIn"},Bq={type:"growCenterIn"};function Iq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Rq;case"scaleIn":return Bq;default:return Eq(t)}}const Dq={type:"clipIn"},Lq={type:"fadeIn"};function Oq(t,e){switch(e){case"grow":return(t=>({type:t.direction===Wh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Wh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Lq;default:return Dq}}function Fq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const zq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Fq(t,!0,nK.appear)}),Hq={type:"fadeIn"},jq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Fq(t,!0,nK.enter)}),Nq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Fq(t,!0,nK.exit)}),Vq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:Fq(t,!0,nK.exit)});function Wq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Hq;case"growRadius":return zq({...t,growField:"radius"});default:return zq({...t,growField:"angle"})}}const Uq={type:"fadeIn"};function Gq(t,e){return"fadeIn"===e?Uq:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function Yq(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const Xq=t=>({type:t.direction===Wh.horizontal?"growWidthOut":"growHeightOut",options:Yq(t)}),$q={type:"fadeIn"};function Kq(t,e){return!1===e?{}:"fadeIn"===e?$q:(t=>({type:t.direction===Wh.horizontal?"growWidthIn":"growHeightIn",options:Yq(t)}))(t)}const qq=t=>({type:"in"===t?"fadeIn":"fadeOut"});function Zq(t,e,i){return"fadeIn"===e?qq(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function Jq(t,e,i){return"fadeIn"===e?qq(i):((t,e)=>{const i=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const Qq=(t,e)=>({custom:RC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class tZ extends oC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;l(r)&&l(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);b(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);b(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class eZ extends EC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Ht(d,u,p,g);return f.defined=e.defined,f}}const iZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},nZ={type:"fadeIn"},sZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),rZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),aZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function oZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return nZ;case"growAngle":return iZ({...t,growField:"angle"});default:return iZ({...t,growField:"radius"})}}const lZ={type:"fadeIn"},hZ={type:"growCenterIn"};function cZ(t,e){switch(e){case"fadeIn":return lZ;case"scaleIn":return hZ;default:return Eq(t,!1)}}const dZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},uZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),pZ={type:"fadeIn"},gZ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function fZ(t,e){return"fadeIn"===e?pZ:uZ(t)}const mZ=t=>({custom:IC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),yZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},_Z=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},vZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===JN.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},bZ=(t,e,i)=>{if(M(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},xZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=bZ(r,n,s);return _Z(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=bZ(r,n,s);return _Z(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),SZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},wZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=SZ(r);return _Z(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=vZ(i),a=SZ(r);return _Z(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),AZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},kZ={type:"fadeIn"};function MZ(t){return!1===t?{}:kZ}const CZ={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},TZ={bar:(t,e)=>({appear:Iq(t,e),enter:Eq(t,!1),exit:Pq(t,!1),disappear:Pq(t)}),bar3d:(t,e)=>({appear:Iq(t,e),enter:Eq(t,!1),exit:Pq(t,!1),disappear:Pq(t)}),line:(t,e)=>({appear:Oq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:EC,duration:CZ.update.duration,easing:CZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:Cq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:Wq(t,e),enter:jq(t),exit:Nq(t),disappear:Vq(t)}),pie3d:(t,e)=>({appear:Wq(t,e),enter:jq(t),exit:Nq(t),disappear:Vq(t)}),rose:(t,e)=>({appear:oZ(t,e),enter:sZ(t),exit:rZ(t),disappear:aZ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:Zq(t,e,"in"),enter:Zq(t,e,"in"),exit:Zq(t,e,"out"),disappear:"clipIn"===e?void 0:Zq(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:eZ,customParameters:t,duration:CZ.update.duration,easing:CZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:Jq(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:Jq(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:tZ,customParameters:t,duration:CZ.update.duration,easing:CZ.update.easing}]}),radarGroup:(t,e)=>({appear:Qq(t,"in"),disappear:Qq(t,"out")}),circularProgress:(t,e)=>({appear:Gq(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:dZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:Kq(t,e),enter:{type:"grow"},disappear:Xq(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:BC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:BC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:mZ(t)}),rangeColumn:(t,e)=>({appear:fZ(t,e),enter:uZ(t),exit:gZ(t),disappear:gZ(t)}),waterfall:(t,e)=>({appear:cZ(t,e),enter:Eq(t,!1),exit:Pq(t,!1),disappear:Pq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:yZ(0,e),enter:xZ(t),exit:wZ(t),disappear:wZ(t)}),circlePacking:(t,e)=>({appear:AZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:MZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:uG},update:{custom:dG},exit:{custom:DC}})},EZ=["appear","enter","update","exit","disappear","normal"];function PZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=l(n)?n(t,s,r):b(n)?n:0;let h=l(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(o+h))},delete t.oneByOne,t}function IZ(t){return t?.[LX]}function DZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function LZ(t){return!function(t){return c(t.timeSlices)}(t)&&c(t.channel)}class OZ extends FK{static type=v$.rect;type=OZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class FZ extends FK{static type=v$.text;type=FZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}dK.useMark([OZ,FZ]);class zZ extends wq{static type=NK.bar;type=NK.bar;_barMarkName=jK.bar;_barMarkType=v$.rect;static mark={...Sq.mark,[jK.bar]:{name:jK.bar,type:v$.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...zZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:DZ(this._spec.animation,this._spec.morph,RZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===Wh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Nh(this.dataToPositionX(e),t),x1:e=>Nh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Fl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",HX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Fl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Nh(this.dataToPositionY(t),e),y1:t=>Nh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",HX.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Nh(this.dataToPositionX(e),t),x1:e=>Nh(this.dataToPositionX1(e),t),y:t=>Nh(this.dataToPositionY(t),e),y1:t=>Nh(this.dataToPositionY1(t),e)},"normal",HX.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(PZ(TZ.bar(t,e),RZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Aq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Aq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Aq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class HZ extends FK{static type=v$.rule;type=HZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}dK.useMark([HZ]);class jZ extends zZ{static type=NK.waterfall;type=NK.waterfall;static mark={...zZ.mark,[jK.leaderLine]:{name:jK.leaderLine,type:v$.rule},[jK.stackLabel]:{name:jK.stackLabel,type:v$.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],h(this._seriesField)&&(this._seriesField=DX)}getSeriesKeys(){return this._seriesField===DX?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),X$(this._dataSet,"waterfallFillTotal",KK),X$(this._dataSet,"waterfall",$K),(h(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=tK(this.getViewData(),this._dataSet,{name:`${$j}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new fq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField()[0],seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jX,endAs:NX,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(PZ(TZ.waterfall(t,e),RZ(jK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec),{dataIndex:i}))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(jZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(jZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n}=this._xAxisHelper;return this._direction===Wh.vertical?n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("width",t)*i:Nh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n}=this._yAxisHelper;return this._direction===Wh.vertical?Nh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+this._rectMark.getAttribute("height",t)*i}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===Wh.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",HX.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",HX.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===Wh.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const NZ=`${$j}_BOX_PLOT_OUTLIER_VALUE`;var VZ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(VZ||(VZ={}));const WZ=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];m(e)||(e=[e]),i.push(...e.map((e=>{const i={[NZ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class UZ extends hq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(VZ.OUTLIER),value:this.getContentValue(VZ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(VZ.MAX),value:this.getContentValue(VZ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.Q3),value:this.getContentValue(VZ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.MEDIAN),value:this.getContentValue(VZ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.Q1),value:this.getContentValue(VZ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.MIN),value:this.getContentValue(VZ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(VZ.SERIES_FIELD),value:this.getContentValue(VZ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===VZ.OUTLIER)return this.series.getOutliersField();if(t===VZ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case VZ.MIN:return this.series.getMinField();case VZ.MAX:return this.series.getMaxField();case VZ.MEDIAN:return this.series.getMedianField();case VZ.Q1:return this.series.getQ1Field();case VZ.Q3:return this.series.getQ3Field();case VZ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===VZ.OUTLIER)return e[NZ];if(t===VZ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case VZ.MIN:return e[this.series.getMinField()];case VZ.MAX:return e[this.series.getMaxField()];case VZ.MEDIAN:return e[this.series.getMedianField()];case VZ.Q1:return e[this.series.getQ1Field()];case VZ.Q3:return e[this.series.getQ3Field()];case VZ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>c(t[NZ])}class GZ extends FK{static type=v$.boxPlot;type=GZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(XN("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(eW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),KV("barBoxplotScaleIn",qV(tW)),KV("barBoxplotScaleOut",ZV(tW))):(XN("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(QV).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),KV("boxplotScaleIn",qV(JV)),KV("boxplotScaleOut",ZV(JV)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class YZ extends FK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:M$.circle,fill:void 0,lineWidth:0}}}class XZ extends YZ{static type=v$.symbol;type=XZ.type}dK.useMark([GZ,XZ]);class $Z extends wq{static type=NK.boxPlot;type=NK.boxPlot;static mark={...Sq.mark,[jK.boxPlot]:{name:jK.boxPlot,type:v$.boxPlot},[jK.outlier]:{name:jK.outlier,type:v$.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark($Z.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark($Z.mark.outlier,{progressive:t,key:LX,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===Wh.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,rK.STATE_NORMAL,HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:v(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},rK.STATE_NORMAL,HX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===Wh.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Nh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Nh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Nh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Nh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Nh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},rK.STATE_NORMAL,HX.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===Wh.vertical?{x:this.dataToPositionX.bind(this),y:e=>Nh(t(this.getDatumPositionValues(e,NZ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Nh(t(this.getDatumPositionValues(e,NZ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,rK.STATE_NORMAL,HX.Series)}}initData(){if(super.initData(),!this._data)return;X$(this._dataSet,"foldOutlierData",WZ),X$(this._dataSet,"addVChartProperty",QK);const t=new No(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${$j}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===Wh.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1),this._outlierDataView=new fq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===Wh.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===Wh.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===Wh.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(TZ.boxPlot()),i=this._initAnimationSpec(RZ(jK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(PZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(PZ(TZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new UZ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class KZ{setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([v$.line,v$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(qZ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",HX.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:k$},"normal",HX.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===A$?t===Wh.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",HX.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",HX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(qZ.point,{morph:DZ(this._spec.animation,this._spec.morph,RZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",HX.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?el(t[this.getStackValueField()]):"link"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?el(t[this.getStackValueField()]):"link"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series))}}const qZ={[jK.point]:{name:jK.point,type:v$.symbol},[jK.line]:{name:jK.line,type:v$.line}};class ZZ extends FK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((c=>{const d=t[c];if(h(d)||s.includes(c))return;a&&r.includes(c)&&(zl(d?.type)||d?.scale||l(d))&&(o=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class JZ extends ZZ{static type=v$.line;type=JZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===NK.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}dK.useMark([JZ,XZ,FZ]);class QZ extends wq{static type=NK.line;type=NK.line;_invalidType="break";static mark={...Sq.mark,...qZ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(PZ(TZ.line(t,e),RZ(jK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(PZ(TZ.symbol(),RZ(jK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}j(QZ,KZ);class tJ extends FK{static type=v$.rect3d;type=tJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}dK.useMark([tJ,FZ]);class eJ extends zZ{static type=NK.bar3d;type=NK.bar3d;static mark={...Sq.mark,[jK.bar3d]:{name:jK.bar3d,type:v$.rect3d}};_barMarkName=jK.bar3d;_barMarkType=v$.rect3d}function iJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===Wh.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if(l()===Wh.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=s(t),o=r(t);if(e===Wh.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===Wh.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",HX.Series)}class nJ extends hq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Wh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class sJ extends zZ{static type=NK.rangeColumn;type=NK.rangeColumn;_barMarkType=v$.rect;_barName=NK.bar;static mark={...zZ.mark,[jK.minLabel]:{name:jK.minLabel,type:v$.text},[jK.maxLabel]:{name:jK.maxLabel,type:v$.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(sJ.mark.bar,{morph:DZ(this._spec.animation,this._spec.morph,RZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===QX.bothEnd?void 0:L({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===QX.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(sJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(sJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Wh.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});iJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Wh.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});iJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===Wh.horizontal?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===Wh.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===Wh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Nh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Nh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=Fl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",HX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=Fl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Nh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Nh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",HX.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(PZ(TZ.rangeColumn({direction:this.direction},e),RZ(jK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new nJ(this)}}dK.useMark([tJ]);class rJ extends sJ{static type=NK.rangeColumn3d;type=NK.rangeColumn3d;_barMarkType=v$.rect3d;_barName=NK.bar3d}class aJ extends ZZ{static type=v$.area;type=aJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}dK.useMark([JZ,aJ,FZ,XZ]);class oJ extends wq{static type=NK.area;type=NK.area;static mark={...Sq.mark,...qZ,[jK.area]:{name:jK.area,type:v$.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(oJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===A$?this._direction===Wh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Wh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Nh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",HX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Nh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",HX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(i,{curveType:e},"normal",HX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(PZ(TZ.line(t,e),RZ(jK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(PZ(TZ.area(t,e),RZ(jK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(PZ(TZ.symbol(),RZ(jK.point,this._spec)))}}j(oJ,KZ);class lJ extends hq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Wh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class hJ extends oJ{static type=NK.rangeArea;type=NK.rangeArea;static mark={...oJ.mark};initMark(){this._areaMark=this._createMark(hJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===A$?this._direction===Wh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Wh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this)},"normal",HX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",HX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])},"normal",HX.Series),this.setMarkStyle(i,{curveType:e},"normal",HX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new lJ(this)}}wr();const cJ={},dJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function uJ(t,e){t&&f(t)||rl("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(cJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=wr().projection(n),n.copy=n.copy||function(){const t=i();return dJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),cJ[i]||null}const pJ={albers:Vr,albersusa:function(){var t,e,i,n,s,r,a=Vr(),o=Nr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Nr().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(pJ).forEach((t=>{uJ(t,pJ[t])}));const gJ="Feature",fJ="FeatureCollection";function mJ(t){const e=N(t);return 1===e.length?e[0]:{type:fJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===fJ?t.features:N(t).filter((t=>!h(t))).map((t=>t.type===gJ?t:{type:gJ,geometry:t}))}(e))),[])}}const yJ=dJ.concat(["pointRadius","fit","extent","size"]);function _J(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{yJ.includes(n)&&(i=i.concat(DN(t[n],e)))})),i):i}const vJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(h(i))for(let i=0;i(l(t),t)))};class bJ extends Sq{type=NK.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(h(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(h(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return h(r)||isNaN(r.x)||isNaN(r.y)?null:r}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${$j}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const xJ=(t,e)=>(t.features&&t.features.forEach((t=>{e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class SJ extends hq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class wJ extends FK{static type=v$.path;type=wJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var AJ,kJ,MJ;dK.useMark([wJ,FZ]),AJ="projection",kJ=class extends MW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return h(this.spec.pointRadius)||this.detach(DN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(DN(t,this.view)),this.commit(),this}size(t){return h(this.spec.size)||this.detach(DN(this.spec.size,this.view)),this.spec.size=t,this.attach(DN(t,this.view)),this.commit(),this}extent(t){return h(this.spec.extent)||this.detach(DN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(DN(t,this.view)),this.commit(),this}fit(t){return h(this.spec.fit)||this.detach(DN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(DN(t,this.view)),this.commit(),this}configure(t){return this.detach(_J(this.spec,this.view)),h(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(_J(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=uJ((t||"mercator").toLowerCase());return e||rl("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),dJ.forEach((t=>{var i,n,s;h(this.spec[t])||(i=this.projection,n=t,s=ON(this.spec[t],e,uJ),l(i[n])&&i[n](s))})),h(this.spec.pointRadius)||this.projection.path.pointRadius(ON(this.spec.pointRadius,e,uJ)),!(h(this.spec.fit)||h(this.spec.extent)&&h(this.spec.size))){const t=mJ(ON(this.spec.fit,e,uJ));this.spec.extent?this.projection.fitExtent(ON(this.spec.extent,e,uJ),t):this.spec.size&&this.projection.fitSize(ON(this.spec.size,e,uJ),t)}return this.projection}output(){return this.projection}},MJ="projections",aX[AJ]={grammarClass:kJ,specKey:null!=MJ?MJ:AJ};class CJ extends bJ{static type=NK.map;type=NK.map;static mark={...Sq.mark,[jK.area]:{name:jK.area,type:v$.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),!this.map)throw new Error(`map type '${this.map}' is not specified !`);if(!K$.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),X$(this._dataSet,"copyDataView",Q$),X$(this._dataSet,"map",xJ),X$(this._dataSet,"lookup",vJ);const t=K$.get(this.map);if(!t)throw Error("no valid map data found!");const e=new No(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??FX,OX],as:[this.nameField,this.valueField,this._seriesField??FX,OX]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new fq(this._option,e)}initMark(){this._pathMark=this._createMark(CJ.mark.area,{morph:DZ(this._spec.animation,this._spec.morph,RZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(CJ.mark.label,{skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>c(t[this._seriesField??FX])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??FX]):this._theme?.defaultFillColor,path:this.getPath.bind(this)},"normal",HX.Series),this.setMarkStyle(t,{smoothScale:!0},"normal",HX.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(PZ(TZ.path(),RZ(jK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec)))}initTooltip(){this._tooltipHelper=new SJ(this)}getPath(t){const e=this._areaCache.get(t?.properties?.[this._nameProperty]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t?.properties?.[this._nameProperty],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===v$.path?s.forEach((t=>{t.getGraphicItem().scale(e,e,i)})):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===v$.path?n.forEach((t=>{t.getGraphicItem().translate(e[0],e[1])})):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return b(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]??t.properties?.[this.nameField]??""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return t=>t?.properties?.[this._nameProperty]}}class TJ extends Sq{coordinate="polar";_outerRadius=AN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=c(t)?N(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=c(t)?N(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=N(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(h(t)||h(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(t)),n=this.radiusAxisHelper.dataToPosition(N(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};Fl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};Fl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),c(this._spec.radius)&&(this._outerRadius=this._spec.radius),c(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Wo(t.angleField,i)&&Wo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const EJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=bl(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},PJ=(t,e)=>{const i=t[0].latestData;return new BJ(e.series,i).updateLabels()};class RJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class BJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=h$(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[tN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:c}=n;if("inside"!==t?.position){const t=Al(e.x,e.y,this._series.computeDatumRadius(s,rK.STATE_HOVER),n.middleAngle),i=Al(e.x,e.y,this._series.computeDatumRadius(s,rK.STATE_SELECTED),n.middleAngle),a=Al(e.x,e.y,this._series.computeDatumRadius(s,rK.STATE_NORMAL),n.middleAngle);s[hN]=a.x,s[cN]=a.y,s[oN]=t.x,s[lN]=t.y,s[fN]=i.x,s[mN]=i.y,s[dN]=l.x,s[uN]=l.y,s[pN]=c.x,s[gN]=c.y,s[iN]=r.y-o.height/2}else s[iN]=r.y;return s[Jj]=this._computeAlign(n),s[Zj]=Math.max(a,0),s[tN]=n.labelVisible&&!h(n.labelText),s[eN]=r.x,s[Qj]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=Al(e.x,e.y,f,t.middleAngle),t.labelLimit=p,at(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=kl(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=kl(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(ot(t.pointB.x,n+r)||at(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?vl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?h(i)||"auto"===i?"edge"===n?kl(t.quadrant)?"left":"right":kl(t.quadrant)?"right":"left":i:h(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=h(n)||h(t[n])||h(t[s]);return l(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class IJ extends FK{type=DJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+wl({angle:e[yN],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class DJ extends IJ{static type=v$.arc;type=DJ.type}dK.useMark([wJ,FZ,DJ]);class LJ extends TJ{_pieMarkName=jK.pie;_pieMarkType=v$.arc;static mark={...Sq.mark,[jK.pie]:{name:jK.pie,type:v$.arc},[jK.labelLine]:{name:jK.labelLine,type:v$.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=bN;_endAngle=xN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=c(t),r=c(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(c(this._spec?.startAngle)?xl(this._spec.startAngle):this._startAngle,c(this._spec?.endAngle)?xl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=c(this._spec?.padAngle)?xl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;X$(this._dataSet,"pie",EJ),X$(this._dataSet,"arcLabel",PJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:sN,asEndAngle:rN,asRatio:nN,asMiddleAngle:yN,asRadian:vN,asQuadrant:_N,asK:aN}},!1);const e=new No(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${$j}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new fq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...LJ.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:DZ(this._spec.animation,this._spec.morph,RZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark(LJ.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark(LJ.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Vh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Vh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ll(sN).bind(this),endAngle:Ll(rN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",HX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,HX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Ll(tN).bind(this),x:Ll(eN).bind(this),y:Ll(iN).bind(this),text:Ll(Qj).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ll(Jj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[yN];return"inside"===this._spec.label?.position?Sl(e):0},limit:Ll(Zj).bind(this)},void 0,HX.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Ll(tN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(RX.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return t?.outerRadius&&(e.outerRadius=()=>this.computeLayoutRadius()*t?.outerRadius),t?.innerRadius&&(e.innerRadius=()=>this.computeLayoutRadius()*t?.innerRadius),t?.cornerRadius&&(e.cornerRadius=()=>this.computeLayoutRadius()*t?.cornerRadius),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${$j}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${$j}_ARC_LABEL_${e}_AY`])} L${Math.round(t[dN])},${Math.round(t[uN])} L${Math.round(t[pN])},${Math.round(t[gN])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(h(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[yN];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=wl({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[yN];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=wl({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===nK.appear)return this._startAngle;if(i===nK.disappear)return this._endAngle;const n=[nK.disappear,nK.exit],s=e.mark.elements,r=t,a=r?.[LX];if(void 0===s.find((t=>t.data[0]?.[LX]t.data[0]?.[LX]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[LX]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+wl({angle:e[yN],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+wl({angle:e[yN],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+wl({angle:e[yN],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+wl({angle:e[yN],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class OJ extends LJ{static type=NK.pie;type=NK.pie}class FJ extends IJ{static type=v$.arc3d;type=FJ.type}dK.useMark([wJ,FZ,FJ]);class zJ extends LJ{static type=NK.pie3d;type=NK.pie3d;_pieMarkName=jK.pie3d;_pieMarkType=v$.arc3d;static mark={...Sq.mark,[jK.pie3d]:{name:jK.pie3d,type:v$.arc3d},[jK.labelLine]:{name:jK.labelLine,type:v$.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ll(sN).bind(this),endAngle:Ll(rN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",HX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,HX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Ll(eN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Ll(iN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Ll(tN).bind(this),x:Ll(eN).bind(this),y:Ll(iN).bind(this),text:Ll(Qj).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ll(Jj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[yN];return"inside"===this._spec.label?.position?Sl(e):0},limit:Ll(Zj).bind(this),...n},void 0,HX.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Ll(tN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const HJ=[10,20],jJ=Ol.Linear,NJ="circle",VJ=Ol.Ordinal,WJ=["circle","square","triangle","diamond","star"];dK.useMark([XZ,FZ]);class UJ extends wq{static type=NK.scatter;type=NK.scatter;static mark={...Sq.mark,[jK.point]:{name:jK.point,type:v$.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if(l(e))return e;if(m(e)){if(h(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${$j}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(d(e)){if(h(t))throw new Error(`${s}Field is required.`);const r={id:`${$j}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return h(e)?10:v(e)?e:!f(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:jJ,defaultRange:HJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return h(e)?NJ:f(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:VJ,defaultRange:WJ},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(UJ.mark.point,{morph:DZ(this._spec.animation,this._spec.morph,RZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(PZ(TZ.scatter({},t),RZ(jK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||el(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:v(this._size)||l(this._size)?this._size:10,shape:f(this._shape)||l(this._shape)?this._shape:NJ},rK.STATE_NORMAL,HX.Series),(c(this._sizeField)||c(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},rK.STATE_NORMAL,HX.User_Mark),(c(this._shapeField)||c(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},rK.STATE_NORMAL,HX.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||el(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},rK.STATE_NORMAL,HX.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class GJ extends TJ{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(NX),this.setInnerRadiusField(jX)}setValueFieldToPercent(){this.setRadiusField(WX),this.setInnerRadiusField(VX)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}dK.useMark([DJ,FZ]);class YJ extends GJ{static type=NK.rose;type=NK.rose;static mark={...zZ.mark,[jK.rose]:{name:jK.rose,type:v$.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(YJ.mark.rose,{morph:DZ(this._spec.animation,this._spec.morph,RZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(YJ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Nh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Nh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Nh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(Sl(e)??0)+90},void 0,HX.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(PZ(TZ.rose(e,t),RZ(jK.rose,this._spec)))}}}dK.useMark([aJ,JZ,XZ,FZ]);class XJ extends GJ{static type=NK.radar;type=NK.radar;static mark={...Sq.mark,...qZ,[jK.area]:{name:jK.area,type:v$.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(XJ.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:k$},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:xl(this._spec.startAngle)??bN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(PZ(TZ.radarGroup(t,e),RZ(jK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(c(i)){const s=TZ[n];i.setAnimationConfig(PZ(s(t,e),RZ(i.name,this._spec)))}}))}}j(XJ,KZ);class $J extends hq{updateTooltipSpec(){super.updateTooltipSpec(),c(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>Vo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const KJ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},qJ={fill:"#bbb",fillOpacity:.2};dK.useMark([XZ,FZ,HZ,OZ]);class ZJ extends wq{static type=NK.dot;type=NK.dot;static mark={...Sq.mark,[jK.group]:{name:jK.group,type:v$.group},[jK.grid]:{name:jK.grid,type:v$.rule},[jK.gridBackground]:{name:jK.gridBackground,type:v$.rect},[jK.dot]:{name:jK.dot,type:v$.symbol},[jK.title]:{name:jK.title,type:v$.text},[jK.subTitle]:{name:jK.subTitle,type:v$.text},[jK.symbol]:{name:jK.symbol,type:v$.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){c(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){c(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){c(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){c(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){c(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),X$(this._option.dataSet,"objFlat",KJ),X$(this._option.dataSet,"copyDataView",Q$),$$(this._option.dataSet,"dataview",Oo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([v$.line,v$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(L(qJ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(ZJ.mark.group),this._containerMark=this._createMark(ZJ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(ZJ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(ZJ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(ZJ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(ZJ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(ZJ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(ZJ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",HX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",HX.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",HX.Series),this._trigger.registerMark(i));const n=this._gridMark;n&&(this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",HX.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",HX.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",HX.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",HX.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(o))}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??FX}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Bh(this._option.getTheme().colorScheme,this.type);return(new zh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??FX}}initTooltip(){this._tooltipHelper=new $J(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class JJ extends hq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>Vo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}dK.useMark([HZ,XZ]);class QJ extends wq{static type=NK.link;type=NK.link;static mark={...Sq.mark,[jK.group]:{name:jK.group,type:v$.group},[jK.link]:{name:jK.link,type:v$.rule},[jK.arrow]:{name:jK.arrow,type:v$.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){c(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){c(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){c(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();X$(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(QJ.mark.group),this._containerMark=this._createMark(QJ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(QJ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(QJ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",HX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",HX.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",HX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?M$.triangleDown:M$.triangleUp},"normal",HX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??FX}}initTooltip(){this._tooltipHelper=new JJ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class tQ extends TJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=xl(this._spec.startAngle)??xl(t?.startAngle)??bN,this._endAngle=xl(this._spec.endAngle)??xl(t?.endAngle)??xN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||c(n?.startAngle)||c(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Nh(this.angleAxisHelper.dataToPosition([t[jX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Nh(this.angleAxisHelper.dataToPosition([t[NX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class eQ extends IJ{static type=v$.arc;static constructorType=v$.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){c(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),c(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const h=c(t.innerPadding)&&c(a)||c(t.outerPadding)&&c(o),d=c(t.innerRadius)&&s||c(t.outerRadius)&&r;if(h||d){const e=Object.assign({},t);return s&&c(a)&&(l(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+(l(s)?s(t,e,i,n):s):l(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&c(o)&&(l(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-(l(r)?r(t,e,i,n):r):l(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}dK.useMark([DJ,eQ]);class iQ extends tQ{static type=NK.circularProgress;type=NK.circularProgress;static mark={...Sq.mark,[jK.track]:{name:jK.track,type:v$.progressArc},[jK.progress]:{name:jK.progress,type:v$.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(iQ.mark.track),this._progressMark=this._createMark(iQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(PZ(TZ.circularProgress({startAngle:this._startAngle},t),RZ(jK.progress,this._spec))),this._trackMark.setAnimationConfig(PZ(TZ.progressBackground(),RZ(jK.track,this._spec)))}}class nQ extends hq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}dK.useMark([OZ]);class sQ extends wq{static type=NK.linearProgress;type=NK.linearProgress;static mark={...Sq.mark,[jK.track]:{name:jK.track,type:v$.rect},[jK.progress]:{name:jK.progress,type:v$.rect},[jK.group]:{name:jK.group,type:v$.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(sQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Nh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Nh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Nh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Nh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(sQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Nh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Nh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(sQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Nh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(lB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Nh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(lB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",HX.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(PZ(TZ.linearProgress(t,e),RZ(jK.progress,this._spec))),this._trackMark.setAnimationConfig(PZ(TZ.progressBackground(),RZ(jK.track,this._spec)))}initTooltip(){this._tooltipHelper=new nQ(this)}}const rQ=[0],aQ=[20,40],oQ=[200,500],lQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},hQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],cQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:dQ,triangle:dQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function dQ(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function uQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const pQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function gQ(t){return l(t)?t:function(){return t}}class fQ{constructor(t){var e,i;switch(this.options=Object.assign({},fQ.defaultOptions,t),l(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>cQ[t]?cQ[t]():cQ.circle())(this.options.shape),this.getText=null!==(e=gQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=gQ(this.options.fontWeight),this.getTextFontSize=gQ(this.options.fontSize),this.getTextFontStyle=gQ(this.options.fontStyle),this.getTextFontFamily=gQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>pQ(10,50);break;case"random-light":this.getTextColor=()=>pQ(50,90);break;default:this.getTextColor=gQ(this.options.color)}if(h(this.options.rotate)){if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}}else this.getTextRotate=l(this.options.rotate)?t=>{var e;return Ut(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Ut(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!h(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class yQ extends fQ{constructor(t){var e;super(Object.assign({},yQ.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.spiral=f(this.options.spiral)?null!==(e=mQ[this.options.spiral])&&void 0!==e?e:mQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=gQ(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:n}=uQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));for(this.data=r;s>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(xQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(bQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}xQ(p,this._size)&&(p=SQ(p,this._size))}else if(xQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||vQ(p,i))&&(!i||!_Q(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function _Q(t,e,i){const n=i[0]>>5,s=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function vQ(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,xQ=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function SQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),G(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=uQ(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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(;ie.left+e.width||t.top>e.top+e.height)}AQ.defaultOptions={enlarge:!1};const MQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},CQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?TQ(t.fontFamily):"sans-serif",u=t.fontStyle?TQ(t.fontStyle):"normal",p=t.fontWeight?TQ(t.fontWeight):"normal",g=t.rotate?TQ(t.rotate):0,f=TQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?TQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",b=null!==(r=t.shrink)&&void 0!==r&&r,x=null!==(a=t.enlarge)&&void 0!==a&&a,S=null!==(o=t.clip)&&void 0!==o&&o,w=null!==(l=t.minFontSize)&&void 0!==l?l:0,A=t.randomVisible,k=t.as||MQ,M=t.depth_3d,C=t.postProjection;let T=t.fontSize?TQ(t.fontSize):14;const E=t.fontSizeRange;if(E&&!v(T)){const t=T;T=e=>EQ(t(e),PQ(t,h),E)}let P=yQ;"fast"===t.layoutType?P=AQ:"grid"===t.layoutType&&(P=wQ);const R=new P({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:T,shrink:b,clip:S,enlarge:x,minFontSize:w,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},TQ=t=>f(t)||v(t)||l(t)?t:e=>e[t.field],EQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],PQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function RQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),DQ=(t,e)=>{let i=0;for(const e of t)IQ(e)?i+=1:i+=.53;return i};function LQ(t){return x(t)?new Promise(((e,i)=>{const n=uB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{Ve.getInstance().error("image 加载失败!",t)}})):null}var OQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function FQ(t){return OQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield LQ(e);r&&(a=yield function(t,e,i){return OQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&HQ(s,n,a-1);)--a;for(;oo&&jQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield LQ(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||zQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function zQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function HQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=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")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||UQ(e,t,r)))return WQ(e,t,r),!0}return!1}function WQ(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function UQ(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function GQ(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(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,s,u).data;let f,m;for(;--n>=p;){const t=i[n];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;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(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 YQ(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=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++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=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?NQ(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=YQ(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return NQ(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){GQ(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!UQ(i,y,_)&&(WQ(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var KQ=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const qQ={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},ZQ=(t,e,i,n)=>KQ(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||rl("WordcloudShape shape must be specified."),t.text||rl("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(BQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||qQ;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=pj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield FQ(l),p=t.colorMode||"ordinal",g={getText:i0(t.text),getFontSize:i0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?i0(t.colorField):i0(t.text),getFillingColor:i0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:i0(t.colorHexField),getFontFamily:i0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:i0(t.padding||1),getFontStyle:i0(t.fontStyle||"normal"),getFontWeight:i0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?i0(t.fontOpacity):()=>1};QQ(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:i0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:i0(t.fillingFontStyle||"normal"),getFillingFontWeight:i0(t.fillingFontWeight||"normal"),getFillingPadding:i0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((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{const i=DQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,P=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),R=Math.max(...P.map((t=>t.fontSize)));P.forEach((t=>t.weight=t.fontSize/R)),P.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield $Q(P,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(BQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),JQ=(t,e,i,n)=>{var s,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 Vl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Vl).domain(e).range(f).scale(t)}}else(new yh).domain(e0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new yh).domain(e0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},QQ=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new kh).domain(e0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&l(s)&&!n){const e=.5,[o,l]=(i.shapeArea,e0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=t0(h,i,!0);n=[~~(e*c),~~c];const d=(new kh).domain(e0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=t0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},t0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=DQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},i0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:l(t)?t:e=>e[t.field]:null,n0=`${$j}_WORD_CLOUD_ANGLE`,s0=`${$j}_WORD_CLOUD_FILLING_ANGLE`,r0=`${$j}_WORD_CLOUD_WEIGHT`,a0=`${$j}_WORD_CLOUD_TEXT`;dK.useMark([FZ]),CN("wordcloud",{transform:CQ,markPhase:"beforeJoin"},!0),CN("wordcloudShape",{transform:ZQ,markPhase:"beforeJoin"},!0);class o0 extends Sq{static mark={...Sq.mark,[jK.word]:{name:jK.word,type:v$.text},[jK.fillingWord]:{name:jK.fillingWord,type:v$.text}};_nameField;_valueField;setValueField(t){c(t)&&(this._valueField=t,this.setFontSizeRange(aQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){c(t)&&c(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??oQ,this._rotateAngles=this._spec.rotateAngles??rQ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:lQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:rQ,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!hQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(o0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(o0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?a0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",HX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(PZ(TZ.wordCloud(),RZ(jK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Bh(this._option.getTheme().colorScheme,this.type);return(new zh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??FX};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new yh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=pl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:r0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:n0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:s0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:a0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?a0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:OX,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?a0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:qo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:OX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:n0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class l0 extends o0{static type=NK.wordCloud;type=NK.wordCloud}class h0 extends o0{static type=NK.wordCloud3d;type=NK.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new yh,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=pl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:r0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:n0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:s0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:a0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?a0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:OX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:OX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:n0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:r0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(o0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(o0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",HX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(PZ(TZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),RZ(jK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(PZ(TZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),RZ(jK.fillingWord,this._spec)))}}const c0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=b(y*f)?y/f:null,x=b(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:x),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},d0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},u0=`${$j}_FUNNEL_TRANSFORM_RATIO`,p0=`${$j}_FUNNEL_REACH_RATIO`,g0=`${$j}_FUNNEL_HEIGHT_RATIO`,f0=`${$j}_FUNNEL_VALUE_RATIO`,m0=`${$j}_FUNNEL_LAST_VALUE_RATIO`,y0=`${$j}_FUNNEL_NEXT_VALUE_RATIO`,_0=`${$j}_FUNNEL_LAST_VALUE`,v0=`${$j}_FUNNEL_CURRENT_VALUE`,b0=`${$j}_FUNNEL_NEXT_VALUE`,x0=`${$j}_FUNNEL_TRANSFORM_LEVEL`,S0=20;class w0 extends hq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===jK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===jK.transform){const e=t?.[p0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===jK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])?t?.[n[0]]:t?.[s]}}class A0 extends FK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class k0 extends A0{static type=v$.polygon;type=k0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}dK.useMark([k0,FZ,HZ]);class M0 extends Sq{static type=NK.funnel;type=NK.funnel;_funnelMarkName=jK.funnel;_funnelMarkType=v$.polygon;_transformMarkName=jK.transform;_transformMarkType=v$.polygon;static mark={...Sq.mark,[jK.funnel]:{name:jK.funnel,type:v$.polygon},[jK.transform]:{name:jK.transform,type:v$.polygon},[jK.transformLabel]:{name:jK.transformLabel,type:v$.text},[jK.outerLabel]:{name:jK.outerLabel,type:v$.text},[jK.outerLabelLine]:{name:jK.outerLabelLine,type:v$.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",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._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;X$(this._dataSet,"funnel",c0),X$(this._dataSet,"funnelTransform",d0);const t=new No(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${$j}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new fq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:v0,asTransformRatio:u0,asReachRatio:p0,asHeightRatio:g0,asValueRatio:f0,asNextValueRatio:y0,asLastValueRatio:m0,asLastValue:_0,asNextValue:b0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:x0}})}initMark(){if(this._funnelMark=this._createMark({...M0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:DZ(this._spec.animation,this._spec.morph,RZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...M0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(M0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(M0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(M0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(M0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new w0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>c(t[this._valueField]),fill:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",HX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",HX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Ll(p0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",HX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",HX.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",HX.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(PZ(TZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),RZ(jK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(PZ(TZ.funnel({},t),RZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(PZ(TZ.label(),RZ(jK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[m0])/2:this._getSecondaryAxisLength(t[f0])/2,s=this._getSecondaryAxisLength(t[f0])/2):(n=this._getSecondaryAxisLength(t[f0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[y0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[x0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return c(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!c(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(v(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-S0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",HX.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",HX.Series)}}function E0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=B0(t.children,u.children,i+1,o,u,r);u.value=h(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else u.isLeaf=!0,u.value=h(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:l,flattenIndex:o}},I0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=I0(t.children,e,t,s))})),n},D0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=D0(t.children,e,t,s)),s=e(t,n,i,s)})),s},L0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:E0,slice:P0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?P0:E0)(t,e,i,n,s)}};class O0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=m(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},O0.defaultOpionts,t);const i=this.options.nodeKey,n=l(i)?i:i?ol(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?R0(this.options.aspectRatio):null!==(e=L0[this.options.splitType])&&void 0!==e?e:L0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},s=[],r=B0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(v(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(v(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}O0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const F0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class z0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];E0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),F0);const n=m(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],n)return this._layoutLabel(t,o(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},z0.defaultOpionts,t):Object.assign({},z0.defaultOpionts);const e=this.options.nodeKey,i=l(e)?e:e?ol(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+fl(this.options.center[0],t.width),n=t.y0+fl(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=m(r),l=o?r.map((t=>fl(t,s))):fl(r,s),c=m(a),d=this.options.gapRadius,u=c?a.map((t=>fl(t,s))):fl(a,s),p=Y(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return h(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:ih(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(m(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=fl(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(m(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],s=B0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=$t({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}z0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const H0=4294967296;function j0(t,e){let i,n;if(W0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function W0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function X0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function $0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function K0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function q0(t){return{_:t,next:null,prev:null}}function Z0(t,e){const i=(t=N(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];X0(s,n,r);let a,o,l,h,c,d,u,p=q0(n),g=q0(s),f=q0(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:m(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const h=[],c=B0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%H0)/H0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=l(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:e1.defaultOpionts.nodeSort;I0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)I0([u],J0(this.options.setRadius)),D0([u],Q0(this._getPadding,.5,d)),I0([u],t1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);I0([u],J0(e1.defaultOpionts.setRadius)),D0([u],Q0(hl,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&D0([u],Q0(this._getPadding,u.radius/t,d)),I0([u],t1(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}e1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const i1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):i1(t.children,e,i)))})),e},n1=(t,e={})=>{if(!t)return[];const i=[];return i1(t,i,e),i},s1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new z0(i).layout(t,{width:n,height:s})};class r1 extends hq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var a1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(a1||(a1={}));const o1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(h(s))return t;if(i.type===a1.DrillDown){return N(g$(t,s,n,"children"))}if(i.type===a1.DrillUp){const e=f$(t,s,n,"children");if(e)return N(e)}return t};class l1{pointerId;parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}parserDragEvent(){return!0}}class h1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!0)}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}}const c1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:l1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:l1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:h1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:h1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:h1}};class d1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return c1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===dn.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;X$(t,"drillFilter",o1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(h(t.datum)||h(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!m(t)||M(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:a1.DrillDown},e().reRunAllTransform(),i.emit(RX.drill,{value:{path:t,type:a1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!m(i)||M(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:a1.DrillUp},t().reRunAllTransform(),e.emit(RX.drill,{value:{path:i,type:a1.DrillUp},model:this}),i}}dK.useMark([DJ,FZ]);class u1 extends TJ{static type=NK.sunburst;type=NK.sunburst;static mark={...Sq.mark,[jK.sunburst]:{name:jK.sunburst,type:v$.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??yq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??OX,getRawData:()=>this.getRawData()}),this._startAngle=Ut(this._spec.startAngle),this._endAngle=Ut(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),X$(this._dataSet,"sunburstLayout",s1),X$(this._dataSet,"flatten",n1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[c(this._centerX)?this._centerX:this.getLayoutRect().width/2,c(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mq,operations:["max","min","values"]},{key:yq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(X$(t.dataSet,"addVChartProperty",QK),t.transform({type:"addVChartProperty",options:{beforeCall:vq,call:xq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(u1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){h(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.y+(c(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rK.STATE_NORMAL,HX.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(u1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return d(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(c(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},rK.STATE_NORMAL,HX.Series)}initTooltip(){this._tooltipHelper=new r1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(v$.arc).forEach((i=>{i.setAnimationConfig(PZ(TZ.sunburst(t,e),RZ(i.name,this._spec)))})),this.getMarksInType(v$.text).forEach((t=>{t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(m(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}j(u1,d1);const p1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new e1(i).layout(t,{width:n,height:s})};class g1 extends hq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}dK.useMark([DJ,FZ]);class f1 extends wq{static type=NK.circlePacking;type=NK.circlePacking;static mark={...Sq.mark,[jK.circlePacking]:{name:jK.circlePacking,type:v$.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??yq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??OX,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();h(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),X$(this._dataSet,"circlePackingLayout",p1),X$(this._dataSet,"flatten",n1),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{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(X$(t.dataSet,"addVChartProperty",QK),t.transform({type:"addVChartProperty",options:{beforeCall:vq,call:xq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(f1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){h(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},rK.STATE_NORMAL,HX.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(f1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rK.STATE_NORMAL,HX.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mq,operations:["max","min","values"]},{key:yq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new g1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(v$.arc).forEach((e=>{e.setAnimationConfig(PZ(TZ.circlePacking({},t),RZ(e.name,this._spec)))})),this.getMarksInType(v$.text).forEach((t=>{t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}j(f1,d1);const m1=t=>{let e=0;return t.forEach(((t,i)=>{var n;h(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=m1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function y1(t){return t.depth}function _1(t,e){return e-1-t.endDepth}const v1=(t,e)=>t.y0-e.y0,b1={left:y1,right:_1,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?W(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:y1,end:_1};class x1{constructor(t){this._ascendingSourceBreadth=(t,e)=>v1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>v1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},x1.defaultOptions,t);const e=this.options.nodeKey,i=l(e)?e:e?ol(e):null;this._getNodeKey=i,this._alignFunc=l(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):b1[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];m1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(h(s.source)||h(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&rl("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&rl("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(f(e)){const t=ct(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(v(e)){if(r=e,v(i))a=i;else if(h(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else l(e)&&v(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}h(this.options.nodeSortBy)&&s.sort(v1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(v1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new x1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},w1=(t,e)=>{if(!t||!e?.view||!m(t))return t;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 t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new x1(e),s=[];return s.push(n.layout(t,i)),s},A1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],k1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class M1 extends hq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(v(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class C1 extends FK{static type=v$.linkPath;type=C1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){XN("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(sW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),KV("linkPathGrowIn",rW),KV("linkPathGrowOut",aW),KV("linkPathUpdate",oW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}dK.useMark([OZ,C1,FZ]),CN("sankey",{transform:S1,markPhase:"beforeJoin"},!0);class T1 extends wq{static type=NK.sankey;type=NK.sankey;static mark={...zZ.mark,[jK.node]:{name:jK.node,type:v$.rect},[jK.link]:{name:jK.link,type:v$.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=$X.Node;_labelLayoutZIndex=$X.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Vt;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){X$(this._dataSet,"sankey",w1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new Ho;$$(t,"dataview",Oo),X$(t,"sankeyNodes",A1),X$(t,"addVChartProperty",QK);const e=new No(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1),this._nodesSeriesData=new fq(this._option,e);const i=new Ho;$$(i,"dataview",Oo),X$(i,"sankeyLinks",k1),X$(i,"addVChartProperty",QK);const n=new No(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:vq,call:bq.bind(this)}},!1),this._linksSeriesData=new fq(this._option,n)}}initMark(){const t=this._createMark(T1.mark.node,{isSeriesMark:!0,key:LX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(T1.mark.link,{key:LX,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(T1.mark.label,{key:LX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},rK.STATE_NORMAL,HX.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},rK.STATE_NORMAL,HX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rK.STATE_NORMAL,HX.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rK.STATE_NORMAL,HX.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(PZ(TZ.sankeyNode(t,e),RZ(jK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(PZ(TZ.sankeyLinkPath(),RZ(jK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(PZ(TZ.label(),RZ(jK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:IX.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:IX.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:IX.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:IX.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(N(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||N(s[r]).includes(e.source)&&N(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(N(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new M1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Bh(this._option.getTheme().colorScheme,this.type),n=new zh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const E1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new O0(e).layout(t,i)},P1=(t,e)=>{let i={},n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=n1(s);return i=pq([{latestData:r}],e),i};class R1 extends hq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class B1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,c1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return c1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:IX.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:IX.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;h(s)||Gh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){c1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){c1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){c1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){c1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:IX.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:IX.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;h(s)&&h(r)||Gh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:IX.chart},(t=>{if(!t.event)return;const{event:n}=t;Gh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:IX.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){c1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:IX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){c1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:IX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:IX.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:IX.chart,source:BX.chart},l),this._eventObj.off(n,{level:IX.chart,source:BX.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:IX.chart,source:BX.chart},l),this._eventObj.on(n,{level:IX.chart,source:BX.chart},o)}}dK.useMark([OZ,FZ]);class I1 extends wq{static type=NK.treemap;type=NK.treemap;static mark={...Sq.mark,[jK.nonLeaf]:{name:jK.nonLeaf,type:v$.rect},[jK.leaf]:{name:jK.leaf,type:v$.rect},[jK.nonLeafLabel]:{name:jK.nonLeafLabel,type:v$.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Vt;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??yq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qt),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??OX,getRawData:()=>this.getRawData()}),b(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),X$(this._dataSet,"treemap",E1),X$(this._dataSet,"flatten",n1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(X$(this._rawData.dataSet,"addVChartProperty",QK),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vq,call:xq.bind(this)}}))}_statisticRawData(){const t=`${$j}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){X$(this._dataSet,"hierarchyDimensionStatistics",P1),X$(this._dataSet,"flatten",n1);const i=new No(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 super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mq,operations:["max","min","values"]},{key:yq,operations:["values"]}])}initMark(){const t=this._createMark(I1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(I1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(I1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(I1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},rK.STATE_NORMAL,HX.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()},rK.STATE_NORMAL,HX.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rK.STATE_NORMAL,HX.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rK.STATE_NORMAL,HX.Series)}initAnimation(){this.getMarksInType(v$.rect).forEach((t=>{t.setAnimationConfig(PZ(TZ.treemap(),RZ(t.name,this._spec)))})),this.getMarksInType(v$.text).forEach((t=>{t.setAnimationConfig(PZ(TZ.label(),RZ(t.name,this._spec)))}))}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 R1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(lV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(lV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}j(I1,B1),j(I1,d1),dK.useMark([wJ,OZ]);class D1 extends tQ{static type=NK.gaugePointer;type=NK.gaugePointer;static mark={...Sq.mark,[jK.pin]:{name:jK.pin,type:v$.path},[jK.pinBackground]:{name:jK.pinBackground,type:v$.path},[jK.pointer]:{name:jK.pointer,type:[v$.path,v$.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?v$.rect:v$.path}initMark(){this._pinBackgroundMark=this._createMark(D1.mark.pinBackground),this._pointerMark=this._createMark({...D1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(D1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===v$.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return c(this.radiusAxisHelper)&&c(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(PZ(TZ.circularProgress({startAngle:this._startAngle},t),RZ(jK.pointer,this._spec)))}}dK.useMark([eQ]);class L1 extends tQ{static type=NK.gauge;type=NK.gauge;static mark={...Sq.mark,[jK.segment]:{name:jK.segment,type:v$.progressArc},[jK.track]:{name:jK.track,type:v$.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=xl(this._spec.padAngle??0)}initData(){super.initData();X$(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[XX]=t[this._angleField[0]],t[YX]=e>0?i[e-1][XX]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(L1.mark.track),this._segmentMark=this._createMark(L1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(c(t[YX])?this.angleAxisHelper.dataToPosition([t[YX]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[XX]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(PZ(TZ.circularProgress({startAngle:this._startAngle},t),RZ(jK.segment,this._spec)))}}class O1 extends hq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return c(i)&&"dimension"===t&&(i.visible=!1),i}}class F1 extends YZ{static type=v$.cell;type=F1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}dK.useMark([F1,FZ]);class z1 extends wq{static type=NK.heatmap;type=NK.heatmap;static mark={...Sq.mark,[jK.cell]:{name:jK.cell,type:v$.cell},[jK.cellBackground]:{name:jK.cellBackground,type:v$.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=N(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(z1.mark.cell,{morph:DZ(this._spec.animation,this._spec.morph,RZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(z1.mark.cellBackground,{progressive:t})}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",HX.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=We(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",HX.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(PZ(TZ.heatmap(t),RZ(jK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new O1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}dK.useSeries([oJ]);class H1 extends YK{static type=VK.area;static view="singleDefault";type=VK.area;seriesType=NK.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([zZ]);class j1 extends YK{static type=VK.bar;static view="singleDefault";type=VK.bar;seriesType=NK.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([eJ]);class N1 extends YK{static type=VK.bar3d;static view="singleDefault";type=VK.bar3d;seriesType=NK.bar3d}dK.useSeries([$Z]);class V1 extends YK{static type=VK.boxPlot;static view="singleDefault";type=VK.boxPlot;seriesType=NK.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??Wh.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===Wh.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),XK(t)}}dK.useSeries([f1]);class W1 extends GK{static type=VK.circlePacking;static view="singleDefault";type=VK.circlePacking;seriesType=NK.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=NK.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class U1 extends GK{static type=VK.common;static view="singleDefault";type=VK.common}class G1 extends GK{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([M0]);class Y1 extends G1{static type=VK.funnel;static view="singleDefault";type=VK.funnel;seriesType=NK.funnel}dK.useSeries([T0]);class X1 extends G1{static type=VK.funnel3d;static view="singleDefault";type=VK.funnel3d;seriesType=NK.funnel3d}const $1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function K1(t){let e=0;return C(t,"tick.visible")&&(e+=C(t,"tick.tickSize")),C(t,"label.visible")&&(e+=C(t,"label.space")),e}function q1(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function Z1(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function J1(t){const e=t?.orient;return"angle"===e||"radius"===e}const Q1=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},T$(t)?r:a)},t2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class e2 extends GK{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=N(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return c(i)&&e.forEach((t=>{h(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],c(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class i2 extends e2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),h(n.angle.type)&&(n.angle.type="linear"),h(n.radius.type)&&(n.radius.type="band");const s=q1(n.angle,{min:0,max:1});h(n.angle.min)&&(n.angle.min=s.min),h(n.angle.max)&&(n.angle.max=s.max)}}dK.useSeries([D1,L1]);class n2 extends i2{static type=VK.gauge;static view="singleDefault";type=VK.gauge;seriesType=NK.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:NK.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===NK.gauge||t.type===NK.circularProgress));h(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&h(e.radiusField)&&h(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===NK.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),h(e.angle.type)&&(e.angle.type="linear"),h(e.radius.type)&&(e.radius.type="linear")}}dK.useSeries([z1]);class s2 extends YK{static type=VK.heatmap;static view="singleDefault";type=VK.heatmap;seriesType=NK.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class r2 extends YK{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}dK.useSeries([zZ]);class a2 extends r2{static type=VK.histogram;static view="singleDefault";type=VK.histogram;seriesType=NK.bar;transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([eJ]);class o2 extends r2{static type=VK.histogram3d;static view="singleDefault";type=VK.histogram3d;seriesType=NK.bar3d}dK.useSeries([QZ]);class l2 extends YK{static type=VK.line;static view="singleDefault";type=VK.line;seriesType=NK.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([CJ]);class h2 extends GK{static type=VK.map;static view="singleDefault";type=VK.map;seriesType=NK.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area}}isValidSeries(t){return t===NK.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class c2 extends e2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}dK.useSeries([OJ]);class d2 extends c2{static type=VK.pie;static view="singleDefault";type=VK.pie;seriesType=NK.pie}dK.useSeries([zJ]);class u2 extends c2{static type=VK.pie3d;static view="singleDefault";type=VK.pie3d;seriesType=NK.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}dK.useSeries([iQ]);class p2 extends i2{static type=VK.circularProgress;static view="singleDefault";type=VK.circularProgress;seriesType=NK.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}dK.useSeries([sQ]);class g2 extends YK{static type=VK.linearProgress;static view="singleDefault";type=VK.linearProgress;seriesType=NK.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="band"),h(e.type)&&(e.type="linear");const n=q1(e,{min:0,max:1});h(e.min)&&(e.min=n.min),h(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="linear"),h(e.type)&&(e.type="band");const n=q1(i,{min:0,max:1});h(i.min)&&(i.min=n.min),h(i.max)&&(i.max=n.max)}}}class f2 extends e2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}dK.useSeries([XJ]);class m2 extends f2{static type=VK.radar;static view="singleDefault";type=VK.radar;seriesType=NK.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:L({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}dK.useSeries([hJ]);class y2 extends YK{static type=VK.rangeArea;static view="singleDefault";type=VK.rangeArea;seriesType=NK.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===Wh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([sJ]);class _2 extends YK{static type=VK.rangeColumn;static view="singleDefault";type=VK.rangeColumn;seriesType=NK.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===Wh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),XK(t)}}dK.useSeries([rJ]);class v2 extends YK{static type=VK.rangeColumn3d;static view="singleDefault";type=VK.rangeColumn3d;seriesType=NK.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===Wh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}dK.useSeries([YJ]);class b2 extends f2{static type=VK.rose;static view="singleDefault";type=VK.rose;seriesType=NK.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??AN,outerRadius:t.outerRadius??AN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}dK.useSeries([T1]);class x2 extends GK{static type=VK.sankey;static view="singleDefault";type=VK.sankey;seriesType=NK.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([UJ]);class S2 extends YK{static type=VK.scatter;static view="singleDefault";type=VK.scatter;seriesType=NK.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}dK.useSeries([ZJ,QJ]);class w2 extends GK{static type=VK.sequence;static view="singleDefault";type=VK.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==NK.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[NK.bar,NK.line,NK.area,NK.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===NK.dot?"band":"linear",visible:t.type!==NK.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===NK.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===NK.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=eK(t.data,this._dataSet,this._spec.data),t.type===NK.link&&(t.dataDot=eK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===NK.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===NK.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=b$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}dK.useSeries([u1]);class A2 extends GK{static type=VK.sunburst;static view="singleDefault";type=VK.sunburst;seriesType=NK.sunburst;getDefaultSeriesSpec(t){const e=c(t.startAngle)?t.startAngle:SN,i=c(t.endAngle)?t.endAngle:e+Gt(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=NK.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([I1]);class k2 extends GK{static type=VK.treemap;static view="singleDefault";type=VK.treemap;seriesType=NK.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([jZ]);class M2 extends j1{static type=VK.waterfall;static view="singleDefault";type=VK.waterfall;seriesType=NK.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&N(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),XK(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class C2 extends GK{type=VK.wordCloud;seriesType=NK.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}dK.useSeries([l0]);class T2 extends C2{static type=VK.wordCloud;static view="singleDefault";type=VK.wordCloud;seriesType=NK.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}dK.useSeries([h0]);class E2 extends C2{static type=VK.wordCloud3d;static view="singleDefault";type=VK.wordCloud3d;seriesType=NK.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class P2{plugins;id=tl();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Go("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this.plugins.find((e=>e.id===t))}getAll(){return this.plugins.slice()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function R2(t){const e={...t};return M(t.style)||(e.textStyle=_$(t.style)),M(t.textStyle)||L(e.textStyle,_$(t.textStyle)),t.shape?.style&&_$(e.shape.style),t.background?.style&&_$(e.background.style),e}function B2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class I2 extends xK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new P2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new TK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case dn.cartesianBandAxis:return Q1(R$(i),"band",e);case dn.cartesianLinearAxis:return Q1(R$(i),"linear",e);case dn.cartesianAxis:case dn.cartesianTimeAxis:return Q1(R$(i),void 0,e);case dn.polarBandAxis:return t2(i.orient,"band",e);case dn.polarLinearAxis:return t2(i.orient,"linear",e);case dn.polarAxis:return t2(i.orient,void 0,e);case dn.cartesianCrosshair:case dn.polarCrosshair:return e.component?.crosshair;case dn.colorLegend:return e.component?.colorLegend[B2(i)];case dn.sizeLegend:return e.component?.sizeLegend[B2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),m(this._originalSpec)?this._spec=this._originalSpec.map((t=>L({},this._theme,t))):this._spec=L({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:BX.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const D2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(h(a)||h(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},L2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{h(i[e])||t.latestData.forEach((t=>{N(i[e]).forEach((i=>{h(t[i])||(h(o[t[i]])&&(o[t[i]]=0),h(n[e])||(o[t[i]]+=parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class O2 extends I2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else Dl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Dl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=R$(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?Wh.horizontal:Wh.vertical)===Wh.horizontal,c(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(c(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):c(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),h(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Fl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(c(t)&&(c(t.userId)&&(this._seriesUserId=N(t.userId)),c(t.specIndex)&&(this._seriesIndex=N(t.specIndex))),c(this._spec.seriesId)){const t=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(c(this._spec.seriesIndex)){const t=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(c(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(c(this._spec.regionId)){const t=N(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(Fl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];let n=!1;if(this._relatedAxisComponent){const s={};Dl(this._regions,(r=>{const a="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,o="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!a||!o)return;const l=a.getAxisId()===this._relatedAxisComponent.id?a:o.getAxisId()===this._relatedAxisComponent.id?o:this._isHorizontal?a:o,h=l===a?o:a,c=Fl(h.getScale(0).type);c&&(n=!0),t.push(r.getRawData());const d=r.getSpec(),u=N(d.xField),p=N(d.yField),g="cartesian"===r.coordinate?u[u.length-1]:d.angleField??d.categoryField,f="cartesian"===r.coordinate?p[p.length-1]:d.radiusField??d.valueField;if(s[r.id]="link"===r.type?"from_xField":l===a?g:f,e.push(s[r.id]),this._valueField){const t="link"===r.type?"from_yField":h===a?g:f;i.push(c?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else n=h(this._spec.valueField),Dl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;$$(s,"dataview",Oo),X$(s,"dataFilterComputeDomain",L2);const r=new No(s);r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:n?this._valueField:null}}},!1),this._data=new DK(this._option,r),r.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&Fl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&Fl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Fl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new rh,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(X$(this._option.dataSet,"dataFilterWithNewDomain",D2),Dl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>Fl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Fl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ct(this._start-s,0,1),a=ct(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}j(O2,B1);class F2 extends O2{static type=dn.scrollBar;type=dn.scrollBar;name=dn.scrollBar;layoutZIndex=$X.DataZoom;layoutLevel=KX.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(h(i))return;if(!m(i))return new F2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new F2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new ZW({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(RX.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return h(i)||(n.padding=i),M(t?.style)||(n.railStyle=_$(t.style)),M(e?.style)||(n.sliderStyle=_$(e.style)),n}}class z2 extends O2{static type=dn.dataZoom;type=dn.dataZoom;name=dn.dataZoom;layoutZIndex=$X.DataZoom;layoutLevel=KX.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(h(i))return;if(!m(i))return new z2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new z2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize)}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new yh;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._stateScale:this._valueScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().x+e};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?this._valueScale:this._stateScale,n=i.domain()[0];return i.scale(n)+this.getLayoutStartPoint().y+e};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new gG({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(RX.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:_$(this._spec.background?.style),startHandlerStyle:_$(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:_$(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:_$(this._spec.middleHandler.background?.style)}},endHandlerStyle:_$(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:_$(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:_$(this._spec.endText?.style)},selectedBackgroundStyle:_$(this._spec.selectedBackground.style),dragMaskStyle:_$(this._spec.dragMask?.style),backgroundChartStyle:{line:L(_$(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,..._$(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:L(_$(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,..._$(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class H2 extends I2{static type=dn.customMark;type=dn.customMark;layoutType="absolute";layoutZIndex=$X.CustomMark;layoutLevel=KX.CustomMark;static createComponent(t,e){return t.customMark?[new H2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${$j}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${$j}_${n}`});if(s&&(h(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),c(t.dataId)||b(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class j2 extends I2{layoutType="absolute";static type=dn.brush;type=dn.brush;name=dn.brush;layoutZIndex=$X.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!h(i)&&!1!==i.visible)return[new j2(i,{...e,specKey:j2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new dY({zIndex:this.layoutZIndex,brushStyle:_$(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=RX.brushChange;r="brushStart"===n||"brushDown"===n?RX.brushStart:"brushEnd"===n||"brushMaskUp"===n?RX.brushEnd:RX.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{..._$(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&De(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&Ie(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){c(this._spec.regionId)&&c(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){c(this._spec.brushLinkSeriesId)&&c(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&N(t).includes(s.userId)||e&&N(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var N2;function V2(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function W2(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function U2(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:W2(t.rect),anchorCandidates:q2(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>V2(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;tV2(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function G2(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=Re(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=$2(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=ln(r,n,i);if(!$2(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],Y2(X2(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=Y2(X2(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=K2(t.rect,a,0),t}));return U2(h)}function Y2(t){return t>180?t-360:t}function X2(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function $2(t,e){for(let i=0;i{const{x:r,y:a}=K2({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(N2||(N2={}));class Z2 extends I2{static type=dn.mapLabel;type=dn.mapLabel;name=dn.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=$X.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!c(i.series)?new Z2(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new No(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new DK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new MG({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=Kh(this._spec.background?.padding),d=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const u={},p=this.dataToPosition(t),g=rB({});if(g.name=`${this.name}_marker_itemContainer_${e}`,u.container=g,this._spec.background?.visible){const t=lB(_$({...this._spec.background.style}));t.setAttributes(p),u.labelBackground=t,g.appendChild(t)}if(this._spec.icon?.visible){const t=dB(_$({...this._spec.icon.style}));t.setAttributes(p),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;u.icon=t,g.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=cB(_$({...this._spec.nameLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.nameLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&c(t[this.valueField])){const e=cB(_$({...this._spec.valueLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.valueLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}const f=Object.values(u).find((t=>!!t&&"group"!==t.type)),m={x:f?.getComputedAttribute("x"),y:f?.getComputedAttribute("y")},y={x:m.x,y:m.y,width:0,height:0};y.width=n+r+(i-1)*d,y.height=s+a;const _={rect:y,point:m,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));_.rect=K2(y,o,l),_.anchors=t,_.offset=l}else _.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:_,contentMarks:u}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:_$({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):U2(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class J2{id;name;service;static Name;constructor(t=J2.Name){this.id=tl(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function Q2(t,e){const i=e.getSpec?.();M(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=T$(e.layoutOrient),r=t[0],a=V(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);Q2(n?n.getChildren():[],t.component),Q2(s?s.getChildren():[],t.component)}}function e3(t){return 2===t.length&&b(t[0])&&b(t[1])&&t[1]>=t[0]}function i3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!b(a.min),extendable_max:!b(a.max)}}function n3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function s3(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function r3(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function a3(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const o3=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),l3=(t,e,i=0)=>{const n=new Wt(t).expand(i/2),s=new Wt(e).expand(i/2);return n.intersects(s)},h3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function d3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=xl(-90));const u=h$(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Wt).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},p3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return o3(p,r.options)};class g3 extends J2{Name="AxisSyncPlugin";constructor(){super(g3.Name)}_checkEnableSync(t){if(!Fl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(RX.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!Fl(i.type)||!Fl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!e3(s)||!e3(r))return;const a=i3(t,s),o=i3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!s3(a,o))return}else if(0===p&&0===g){if(!s3(o,a))return}else if(u||y)if(u&&!y){if(!n3(a,o))return}else if(y&&!u){if(!n3(o,a))return}else{if(h===g)return;if(h>g){if(!r3(a,o))return}else if(!r3(o,a))return}else{if(0===h&&0===p){if(!a3(a,o))return}else if(0===g&&0===l&&!a3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){X$(e.getOption().dataSet,"tickAlign",p3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var f3={AxisLabelOverlapPlugin:t3,AxisSyncPlugin:g3};const m3=t=>t,y3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!c3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},_3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?h3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return o3(t.domain());let h;if(c(s))h=t.stepTicks(s);else if(c(n))h=t.forceTicks(n);else if(c(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=K1(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=K1(r),c=h$(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Rl(u),{x:m,y:y}=$t({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Wt).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=b3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}else h=t.domain();return o3(h)},b3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&l3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},x3=(t,e)=>{if(Fl(t.type))return((t,e)=>{if(!Fl(t.type))return o3(t.domain());const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=c(s)?t.stepTicks(s):c(n)?t.forceTicks(n):t.ticks(i??5),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=u3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&d3(s,i);)s=y3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),V(a)!==V(r)&&a.push(V(r))),r=a}return o3(r)})(t,e);if(Hl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(c(s))l=t.stepTicks(s);else if(c(n))l=t.forceTicks(n);else if(c(i))l=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=u3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=_3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}else l=t.domain();return o3(l)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return v3(t,e)}return o3(t.domain())};class S3 extends I2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),c(this._spec.id)&&t.setUserId(this._spec.id),o(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==C(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=PZ(TZ.axis(),{appear:this._spec.animationAppear??C(this._option.getChart().getSpec(),"animationAppear.axis")??C(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??C(this._option.getChart().getSpec(),"animationDisappear.axis")??C(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??C(this._option.getChart().getSpec(),"animationEnter.axis")??C(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??C(this._option.getChart().getSpec(),"animationExit.axis")??C(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??C(this._option.getChart().getSpec(),"animationUpdate.axis")??C(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return Dl(this._regions,(e=>{m(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;c(t)&&(this._seriesUserId=N(t)),c(i)&&(this._regionUserId=N(i)),c(e)&&(this._seriesIndex=N(e)),c(n)&&(this._regionIndex=N(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(Dl(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!Fl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(Dl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===$U.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&h(t.title.angle)&&(i="left"===t.orient?-90:90,e=$1[t.orient]),{orient:this.orient,select:t.select,hover:t.hover,line:(n=t.domainLine,m$(n),m$(n.startSymbol),m$(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:l(t.label.style)?(e,i)=>{const n=this._preprocessSpec(t.label.style(e.rawValue,i,e));return _$(this._preprocessSpec(L({},this._theme.label?.style,n)))}:_$(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:y$(t.label.state),autoRotate:!!t.label.autoRotate,autoHide:!!t.label.autoHide,autoLimit:!!t.label.autoLimit,autoRotateAngle:t.label.autoRotateAngle,autoHideMethod:t.label.autoHideMethod,autoHideSeparation:t.label.autoHideSeparation,limitEllipsis:t.label.limitEllipsis,layoutFunc:t.label.layoutFunc},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:l(t.tick.style)?(e,i)=>{const n=this._preprocessSpec(t.tick.style(e.rawValue,i,e));return _$(this._preprocessSpec(L({},this._theme.tick?.style,n)))}:_$(t.tick.style),state:y$(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:_$(t.subTick.style),state:y$(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:l(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return _$(this._preprocessSpec(L({},this._theme.grid?.style,n)))}:_$(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:_$(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Ut(i):null,textStyle:L({},e,_$(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:_$(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:_$(t.title.background?.style)},state:{text:y$(t.title.state),shape:y$(t.title.shape?.state),background:y$(t.title.background?.state)}},panel:{visible:t.background?.visible,style:_$(t.background?.style),state:y$(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const w3=[f3.AxisLabelOverlapPlugin,f3.AxisSyncPlugin];class A3 extends S3{static type=dn.cartesianAxis;type=dn.cartesianAxis;name=dn.cartesianAxis;layoutType="region-relative";layoutZIndex=$X.Axis;layoutLevel=KX.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;_verticalLimitSize;constructor(t,e){super(t,{...e}),this._orient=R$(t,["z"]),P$(this._orient)&&(this.layoutType="absolute"),c(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?T$(t)?"linear":"band":T$(t)?"band":"linear"}(t.orient,i),s=`${A3.type}-${n}`,r=b$.getComponentInKey(s);if(r){let n=t.inverse;return i&&!T$(t.orient)&&(n=!c(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(A3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[A3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===Wh.horizontal;if(!m(i))return Z1(i)?A3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>E$(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{Z1(t)&&a.push(A3.createAxis(t,{...e,specIndex:i,specKey:A3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),Dl(this._regions,(t=>{T$(this.orient)?t.setXAxisHelper(this.axisHelper()):E$(this.orient)?t.setYAxisHelper(this.axisHelper()):P$(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];T$(this.orient)?b(e)&&(s=n?[e,0]:[0,e]):P$(this.orient)?b(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):b(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(w3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();T$(this.orient)?h(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):h(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=T$(this.orient)?t.fieldX:P$(this.orient)?t.fieldZ:t.fieldY,Fl(this._scale.type)?e:[e[0]]}_initData(){$$(this._option.dataSet,"scale",m3),X$(this._option.dataSet,"ticks",x3);const t=this._spec.label||{},e=this._tick||{},i=new No(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new DK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(lV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(T$(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(RX.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Dl(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return Dl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:T$(this.orient)?i.fieldX:P$(this.orient)?i.fieldZ:i.fieldY,n=m(n)?Fl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Dl(this._regions,(t=>{T$(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):E$(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):P$(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;b(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),b(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=T$(this.orient)?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=T$(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(L({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=L({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&h(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=T$(this.orient),s=t=>(n?!T$(t.orient):T$(t.orient))&&Fl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(c(t))a=r.find((e=>e.id===t));else if(c(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const k3=Math.sqrt(50),M3=Math.sqrt(10),C3=Math.sqrt(2);class T3{_extend={};setExtraAttrFromSpec(){c(this._spec.nice)&&(this._nice=this._spec.nice),c(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=q1(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];c(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),c(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(W(t)-function(t){if(t&&m(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=k3?10:s>=M3?5:s>=C3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(RX.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}j(R3,P3);class B3 extends E3{static type=dn.cartesianTimeAxis;type=dn.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),Dl(this._regions,(t=>{T$(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=L({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new No(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new DK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=Vo.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return m(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&m(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class I3 extends S3{static type=dn.polarAxis;type=dn.polarAxis;name=dn.polarAxis;layoutType="absolute";layoutZIndex=$X.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=bN;get startAngle(){return this._startAngle}_endAngle=xN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${I3.type}-${i}`,s=b$.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(I3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!m(i))return J1(i)?(i.center=t.center,i.startAngle=t.startAngle??SN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:wN),I3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!J1(i))return;i.center=t.center,i.startAngle=t.startAngle??SN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:wN),i.outerRadius=i.radius??t.outerRadius??t.radius??AN;const o=I3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),Dl(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=xl(this._spec.startAngle??SN),this._endAngle=xl(this._spec.endAngle??(c(this._spec.startAngle)?this._spec.startAngle+360:wN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(RX.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){$$(this._option.dataSet,"scale",m3),X$(this._option.dataSet,"ticks",x3);const t=this._spec.label||{},e=this._spec.tick||{},i=new No(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new DK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return Dl(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=m(n)?Fl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Dl(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return Fl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=wl({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=jt.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=AN,e=0;const i=this.getChart().getSpec();return Dl(this.getRegions(),(n=>{const s=n;if(function(t){return[NK.rose,NK.radar,NK.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;b(n)&&(t=n),b(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(L({},this._axisStyle,t))}}class D3 extends I3{static type=dn.polarLinearAxis;type=dn.polarLinearAxis;_zero=!0;_nice=!0;_scale=new yh;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}j(D3,T3);class L3 extends I3{static type=dn.polarBandAxis;type=dn.polarBandAxis;_scale=new rh;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function O3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:p,regionId:g,regionIndex:f,seriesIndex:m,seriesId:y,padding:_,...v}=L({},t),b=v;return i.visible&&(b.title=R2(i)),M(n.focusIconStyle)||_$(n.focusIconStyle),m$(n.shape),m$(n.label),m$(n.value),m$(n.background),Yh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),Yh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),Yh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),b.item=n,M(s.textStyle)||_$(s.textStyle),m$(s.handler),b.pager=s,r.visible&&!M(r.style)&&(L(b,r.style),c(r.padding)&&(b.padding=r.padding)),b}j(L3,P3);const F3=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},z3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return c(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class H3 extends I2{layoutType="normal";layoutZIndex=$X.Legend;layoutLevel=KX.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{Dl(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Dl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Uh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;c(i)&&(this._seriesUserId=N(i)),c(t)&&(this._regionUserId=N(t)),c(n)&&(this._seriesIndex=N(n)),c(e)&&(this._regionUserIndex=N(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new DK(this._option,t),this._initSelectedData(),Dl(this._regions,(t=>{t.event.on(RX.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;h(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(RX.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;b(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(L({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(L({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class j3 extends H3{static type=dn.discreteLegend;type=dn.discreteLegend;name=dn.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return i.type&&"discrete"!==i.type?void 0:new j3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new j3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),Dl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){X$(this._option.dataSet,"discreteLegendFilter",z3),X$(this._option.dataSet,"discreteLegendDataMake",F3);const t=new No(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!il(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=p$(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...O3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return zG}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(IG.legendItemClick,(e=>{const i=C(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(RX.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(IG.legendItemHover,(t=>{const e=C(t,"detail");this.event.emit(RX.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(IG.legendItemUnHover,(t=>{const e=C(t,"detail");this.event.emit(RX.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:b(r)?r:1,strokeOpacity:b(a)?a:1,opacity:b(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return l(this._spec.data)?this._spec.data(t):t}}const N3=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;b(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},V3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!M(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function W3(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:d,id:u,visible:p,orient:g,position:f,data:m,defaultSelected:y,field:_,filter:v,regionId:b,regionIndex:x,seriesIndex:S,seriesId:w,padding:A,...k}=L({},t),C=k;return e.visible&&(C.title=R2(e)),C.showHandler=!1!==i.visible,M(i.style)||(C.handlerStyle=_$(i.style)),c(n.width)&&(C.railWidth=n.width),c(n.height)&&(C.railHeight=n.height),M(n.style)||(C.railStyle=_$(n.style)),M(s.style)||(C.trackStyle=_$(s.style)),C.startText=m$(r),C.endText=m$(a),C.handlerText=m$(o),M(l)||(C.sizeBackground=_$(l)),h.visible&&!M(h.style)&&(L(C,h.style),c(h.padding)&&(C.padding=h.padding)),C}function U3(t){return"color"===t||"size"===t}const G3={color:WG,size:GG},Y3=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],X3=[2,10];class $3 extends H3{static type=dn.continuousLegend;type=dn.colorLegend;name=dn.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return U3(i.type)?new $3(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{U3(t.type)&&n.push(new $3(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?dn.colorLegend:dn.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),Dl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){X$(this._option.dataSet,"continuousLegendFilter",V3),X$(this._option.dataSet,"continuousLegendDataMake",N3);const t=new No(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=p$(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!il(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=p$(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),M(n)&&(n="color"===this._legendType?Y3:X3);const r={...W3(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return G3[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",gt((e=>{const i=C(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(RX.legendFilter,{model:this,value:i,event:e})}),30))}}}const K3=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),N(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class q3 extends I2{static type=dn.indicator;type=dn.indicator;name=dn.indicator;layoutType="absolute";layoutZIndex=$X.Indicator;layoutLevel=KX.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==q3.type)return null;const i=N(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map((t=>new q3(t,e)));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){X$(this._option.dataSet,"indicatorFilter",K3);const t=new No(this._option.dataSet);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 DK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return N(this._spec.content).forEach((t=>{const e=L({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{..._$(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!c(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{..._$(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new $G(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":l(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return Dl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){super.clear(),this._indicatorComponent=null,this._cacheAttrs=null}}class Z3 extends I2{static type=dn.title;type=dn.title;layoutType="normal";layoutZIndex=$X.Title;layoutLevel=KX.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Uh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!m(i))return new Z3(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new Z3(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;b(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),b(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:b(t.width())?t.width():0,height:this._spec.height?this._spec.height:b(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new YG(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class J3{projection;constructor(t){if(this.projection=uJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function Q3(t,e){return`${$j}_${e}_${t}`}class t5 extends I2{static type=dn.geoCoordinate;type=dn.geoCoordinate;name=dn.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:Q3(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(h(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new t5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=L(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(RX.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new J3(this._projectionSpec)}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===NK.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===NK.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(NK.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==NK.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}j(t5,B1);const e5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},i5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class n5 extends I2{layoutType="absolute";gridZIndex=$X.CrossHair_Grid;labelZIndex=$X.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach(((t,i)=>this._registerEvent(t,m(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:BX.chart},this._handleEvent),this.event.on(e,{level:IX.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ft((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(e5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(m(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(e5[e][t]),s=s.concat(e5[e][i(t)])})),{in:n,out:s}}return{in:e5[e][t],out:e5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=C(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{i5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),m(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function r5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var a5,o5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(a5||(a5={}));class l5 extends n5{static type=dn.cartesianCrosshair;type=dn.cartesianCrosshair;name=dn.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.xField||i.yField?new l5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new l5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,a5.VERTICAL,!0),this.layoutByValue(a5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,a5.HORIZONTAL,!1),this.layoutByValue(a5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return Fl(t.getScale().type)&&b(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){T$(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{Hl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(a5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=a5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,d;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(Hl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(Fl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=r5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=K1(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(Hl(s.type)){const t=s._step;d=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(Fl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=r5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(d=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):d=1,a=r}}if(this.yHair.label?.visible){const e=K1(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(a5.HORIZONTAL&&this._layoutHorizontal(n,d??0),a5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new _U({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new vU({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new mU(e)),n.add(t)),s5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(o5||(o5={}));class h5 extends n5{static type=dn.polarCrosshair;type=dn.polarCrosshair;name=dn.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.categoryField||i.valueField?new h5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new h5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{Hl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});Fl(s.getScale().type)&&b(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:jt.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(o5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",L(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=K1(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=K1(t.getSpec())),n.angle=i.angle,n.axis=t,L(n,s)}))),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(o5.HORIZONTAL&&this._layoutHorizontal(n),o5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:$t(l,n,i),end:$t(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new _U({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new xU({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Rl(i),e={...$t(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Kt(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=$t(t,s,p),m=$t(t,s,g),y=ve([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=ct(jt.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new SU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new bU({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=bl(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}}(i),n={...$t(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new mU(e),n.add(t),i(t)),s5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const c5=t=>_$({...t}),d5=t=>({...t,style:{..._$(t.style)}}),u5=t=>{const e=c5(t?.slider?.trackStyle??{}),i=c5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},_$({...s}));var s;const r=d5(t?.controller?.start??{}),a=d5(t?.controller?.pause??{}),o=d5(t?.controller?.backward??{}),l=d5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},p5=(t,e)=>({...u5(t),data:e,type:"continuous"}),g5=(t,e)=>({...u5(t),data:e,type:"discrete"}),f5=t=>"left"===t||"right"===t,m5=t=>"top"===t||"bottom"===t;class y5 extends I2{layoutZIndex=$X.Player;layoutLevel=KX.Player;static type=dn.player;type=dn.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return h(i)||!1===i.visible?null:new y5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),b(t.x)){const e=f5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(b(t.y)){const e=m5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(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}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{...g5(this._spec,this._specs),...e}:{...p5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new oY(t):this._playerComponent=new hY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 v(this._spec.width)?Math.min(t.width,Number(this._spec.width)):f5(this._orient)?this._maxSize():t.width}_computeHeight(t){return v(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):m5(this._orient)?this._maxSize():t.height}_computeDx(t){return f5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return m5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size),(f5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(f5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(RX.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(iY.OnEnd,(()=>{this.event.emit(RX.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(iY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];N(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(RX.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(iY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(RX.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const _5=(t,e)=>Cl(t[0].latestData,e.field),v5=(t,e)=>Tl(t[0].latestData,e.field);function b5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function x5(t,e){return El(t[0].latestData,e.field)}function S5(t,e){return Pl(t[0].latestData,e.field)}function w5(t,e){return function(t,e){return Math.sqrt(Pl(t,e))}(t[0].latestData,e.field)}function A5(t,e){return function(t,e){return Z(t.map((t=>t[e])))}(t[0].latestData,e.field)}function k5(t,e){const i={min:_5,max:v5,sum:b5,average:x5,variance:S5,standardDeviation:w5,median:A5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(c(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(c(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function M5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.x)){v(t.x)&&E5(u,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function C5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.y)){v(t.y)&&E5(u,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function T5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();v(t.x)&&E5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),v(t.y)&&E5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function E5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const P5=["sum","average","min","max","variance","standardDeviation","median"];class R5 extends I2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||P5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??N(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(N(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Cl(t,e),r=Tl(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class I5 extends R5{static type=dn.markLine;type=dn.markLine;name=dn.markLine;layoutZIndex=$X.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new I5(i,{...e,specKey:I5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new I5(t,{...e,specIndex:i,specKey:I5.speckey}))})),n}_createMarkerComponent(){const t=new AG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:_$(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:_$(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:_$(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{..._$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{..._$(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:_$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)||c(t.coordinates)&&c(t.process)&&c(t.process.x),a=c(t.y)||c(t.coordinates)&&c(t.process)&&c(t.process.y),o=c(t.coordinates)&&(!c(t.process)||"process"in t&&"xy"in t.process),l=c(t.positions),h=t?.autoRange??!1;let d=[];r?d=M5(e,i,n,s,h)[0]:a?d=C5(e,i,n,s,h)[0]:o?d=T5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;X$(this._option.dataSet,"markerAggregation",k5),X$(this._option.dataSet,"markerRegression",B5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new No(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new No(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class D5 extends R5{static type=dn.markArea;type=dn.markArea;name=dn.markArea;layoutZIndex=$X.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new D5(i,{...e,specKey:D5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new D5(t,{...e,specIndex:i,specKey:D5.speckey}))})),n}_createMarkerComponent(){const t=new kG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:_$(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{..._$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{..._$(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:_$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)&&c(t.x1),a=c(t.y)&&c(t.y1),o=c(t.coordinates),l=c(t.positions),h=t?.autoRange??!1;let d=[],u=[];r?(u=M5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):a?(u=C5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):o?d=T5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=c(t.x)&&c(t.x1),n=c(t.y)&&c(t.y1),s=c(t.coordinates);if(!i&&!n&&!s)return null;let r;X$(this._option.dataSet,"markerAggregation",k5),X$(this._option.dataSet,"markerRegression",B5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new No(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class L5 extends R5{static type=dn.markPoint;type=dn.markPoint;name=dn.markPoint;layoutZIndex=$X.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new L5(i,{...e,specKey:L5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new L5(t,{...e,specIndex:i,specKey:L5.speckey}))})),n}_createMarkerComponent(){const t=new MG({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:_$(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:_$(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{..._$(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{..._$(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:_$(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=T5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!c(t.coordinate))return;X$(this._option.dataSet,"markerAggregation",k5);const i=this._processSpecCoo(t),n=new No(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const O5=(t,e,i)=>h(t)?t:l(t)?t(e,i):t,F5=(t,e,i)=>{if(h(t))return t;if(m(t)){const n=[];return t.forEach((t=>{if(l(t)){const s=t(e,i);c(s)&&n.push(s)}else n.push(t)})),n}return l(t)?t(e,i):t};const z5=(t,e)=>(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight),H5="vchart-tooltip-container",j5=20,N5={key:"其他",value:"..."},V5={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class W5{static dom=`${$j}_TOOLTIP_HANDLER_DOM`;static canvas=`${$j}_TOOLTIP_HANDLER_CANVAS`}const U5=(t,e,i)=>{const n=O5(e.key,t,i),s=O5(e.value,t,i),r=!1!==O5(e.visible,t,i)&&(c(n)||c(s)),a=O5(e.isKeyAdaptive,t,i),o=O5(e.shapeType,t,i),l=O5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},G5=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,Y5=(t,e)=>{let i;if(c(t))if(v(t))i=t;else if(l(t)){const n=t(e);v(n)&&(i=n)}return i},X5=(t,e)=>{const i=h$(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function $5(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Tj,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var K5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(K5||(K5={}));class q5{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),K5.success):(this._updateTooltip(!1,e),K5.success)}if(h(n)||h(s))return K5.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(c(t.visible)||c(t.activeType)?s.visible=oq(t).includes("mark"):c(e.visible)||c(e.activeType)?s.visible=oq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=G5(i,"mark")??{},a=L({},R(e.mark),R(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(c))),[]);if(t.every((t=>!oq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:c(e.visible)||c(e.activeType)?s.visible=oq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=G5(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{l(t)?o.push(t):o.push(...N(t))})),r={...i[0],content:o};let d={};const u=t.filter((t=>{const e=t.tooltipHelper?.spec;return c(e?.dimension)&&oq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(u.length){let t=[];u.every((({content:t})=>h(t)))?t=void 0:u.forEach((({content:e})=>{h(e)||(l(e)?t?.push(e):t?.push(...N(e)))})),d={...u[0],content:t}}a=L({},R(e.dimension),d)}const o=r.title,d={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(c(a.title))if(l(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...d,...n}}}else a.title={...r.title,...d,...a.title};else a.title={...r.title,...d};const u=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),p=N(r.content);if(c(a.content))if(l(a.content)){const t=a.content;a.content=(e,i)=>{const n=N(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...u(p[0]),...t}})),n}}else{const t=N(a.content);t.forEach(((e,i)=>{t[i]={...u(p[0]),...e}}))}else a.content=p.map((t=>({...t,...u(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return K5.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??K5.success;const a=r[n];if(!a)return K5.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),h(o.title?.key)&&h(o.title?.value)&&!o.content?.length?K5.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??K5.success;const o=i[n];if(!o)return K5.failed;const l=this._getActualTooltipPosition(e,F5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),K5.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=v(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...V5,offsetX:t?.x??V5.offsetX,offsetY:t?.y??V5.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=F5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=F5(t.title,e,i),s=N(F5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=j5}=t,o=!1!==O5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,c(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=O5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=U5(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...N5});break}if(!(r.content.lengthh(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=U5(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...N5});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(h(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),h(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!c(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,u=this._component.getSpec(),p="canvas"===u.renderMode,g=i?.chart?.getCanvasRect(),f=g?.width??Kj,m=g?.height??qj;let y,_,v,x,S,w,A=!1;if(d(e)){const{left:t,right:i,top:n,bottom:s}=e;y=Y5(t,r),_=Y5(n,r),v=Y5(i,r),x=Y5(s,r)}else if(c(e)&&"mark"===t.activeType){A=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case C$.left:y=t-a-l,_=(i+c)/2-o/2;break;case C$.right:y=n+l,_=(i+c)/2-o/2;break;case C$.top:y=(t+n)/2-a/2,_=i-o-h;break;case C$.bottom:y=(t+n)/2-a/2,_=c+h;break;case C$.inside:y=(t+n)/2-a/2,_=(i+c)/2-o/2}}}const k={width:0,height:0},M=(t=0)=>({x:t,y:t});let C=M(),T=M(),E=1,P=1;if(qo(this._env)&&!u.confine){if(k.width=window.innerWidth,k.height=window.innerHeight,!p){T=n.getBoundingClientRect();const t=this._compiler.getCanvas()??this._chartContainer,e=t.getBoundingClientRect();C={x:e.x-T.x,y:e.y-T.y},E=z5(t,e),P=z5(n,T)}}else k.width=f,k.height=m;const{canvasX:R,canvasY:B}=r;S=b(y)?y:b(v)?f-a-v:R+l,w=b(_)?_:b(x)?m-o-x:B+h,S*=E,w*=E,qo(this._env)&&(S+=C.x,w+=C.y),S/=P,w/=P;const{width:I,height:D}=k;return(S+a)*P+T.x>I&&(A?S=(I-T.x)/P-a:S-=2*l+a),(w+o)*P+T.y>D&&(A?w=(D-T.y)/P-o:w-=2*h+o),S*P+T.x<0&&(S=0-T.x/P),w*P+T.y<0&&(w=0-T.y/P),{x:S,y:w}};_getTooltipBoxSize(t,e){return e&&!h(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:m="",hasShape:y,shapeType:_="",shapeHollow:v,shapeColor:b}=h;if(l.title.visible=f,f){const{text:t,width:e,height:i}=X5(m,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},u=e,g=i,y&&VP[_]){const t={symbolType:_};v?t.stroke=b:t.fill=b,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],h=[],d=[];l.content=t.map(((l,u)=>{const g={height:0,spaceRow:i};let f=0;const{hasShape:m,key:y,shapeColor:_,shapeHollow:v,shapeType:b="",value:x,isKeyAdaptive:S}=l;if(c(y)){const{width:t,height:e,text:i}=X5(y,a);g.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},S?h.push(t):n.push(t),f=Math.max(f,e)}if(c(x)){const{width:t,height:e,text:i}=X5(x,o);g.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},d.push(t),f=Math.max(f,e)}if(m&&VP[b]){e=!0;const t={visible:!0,symbolType:b};v?t.stroke=_:t.fill=_,f=Math.max(r.size,f),g.shape=t}else g.shape={visible:!1};return g.height=f,p+=f,uc(t)?m(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function J5(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=L({},e,t),d={};return d.fontFamily=i,d.fontSize=Z5(n),d.color=s,d.textAlign=r,d.lineHeight=Z5(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=Z5(c),d}function Q5(t,e){if(!t)return;const{size:i}=L({},e,t),n={};return n.width=Z5(i),n}class t4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===t4.type}type=t4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return t4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=Ko?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(t4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const e4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},i4={boxSizing:"border-box"},n4={display:"flex",whiteSpace:"nowrap"},s4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},r4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},a4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},o4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},l4={lineHeight:"normal"};class h4 extends t4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!VP[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=VP[e].pathStr;let o="currentColor";if(!n||f(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(d(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class c4 extends t4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class d4 extends t4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=$(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=$(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},s4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=L({},a?a4:r4,{height:Z5(i[n].height),...t.keyColumn.item});f(r)&&""!==r?.trim?.()||v(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=L({},o4,{height:Z5(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=L({},l4,{height:Z5(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class u4 extends t4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new d4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new d4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new d4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(L({},n4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class p4 extends t4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new h4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new c4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(L({},e4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class g4 extends t4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&c(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new p4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new u4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},i4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class f4 extends q5{type=W5.dom;_tooltipContainer=Ko?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(Ko&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:d,lineWidth:u=0},padding:p,key:g,value:f,title:m,shape:y,enterable:_,spaceRow:v,transitionDuration:b}=t,x=i,S={panel:{width:Z5((e?.panel?.width??0)+2*u),height:Z5((e?.panel?.height??0)+2*u),paddingBottom:Z5(p.bottom),paddingLeft:Z5(p.left),paddingRight:Z5(p.right),paddingTop:Z5(p.top),borderColor:d,borderWidth:Z5(u),borderRadius:Z5(h),backgroundColor:x?`${x}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:_?"auto":"none",transitionDuration:b?`${b}ms`:"initial",transitionProperty:b?"transform":"initial",transitionTimingFunction:b?"ease-out":"initial"},title:J5(m),content:{},shapeColumn:{item:Q5(y),width:Z5(y.size),marginRight:Z5(y.spacing??8)},keyColumn:{item:J5(g),width:Z5(e?.keyWidth),marginRight:Z5(g.spacing??26)},valueColumn:{item:J5(f),width:Z5(e?.valueWidth),marginRight:Z5(f.spacing??0)},spaceRow:Z5(v)};if(c(v)){const t=v/2;[S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((e=>{e.marginTop=Z5(t),e.marginBottom=e.marginTop})),S.content.marginTop=Z5(-t),S.content.marginBottom=S.content.marginTop}else[S.content,S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return S}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class m4 extends q5{type=W5.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new mY({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}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?c(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class y4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&c(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??K5.success:K5.failed}class _4 extends y4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![W5.dom,W5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!lq(t)&&!h(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...L$(r,a)??[],...H$(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(c(i))break}return c(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class v4 extends y4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![W5.dom,W5.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const b4=t=>c(t)&&!m(t),x4=t=>c(t)&&m(t);class S4 extends I2{static type=dn.tooltip;type=dn.tooltip;name=dn.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!m(i))return new S4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new S4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?m4:f4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new v4(this),dimension:new _4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:IX.chart},this._handleMouseMove),(Zo(e)||Jo(e))&&(this._mountEvent("pointerdown",{level:IX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:IX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;qo(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||lq(t)||(n&&b4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&x4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):c(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!h(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&dK.globalConfig.uniqueTooltip&&dK.hideTooltip(a.id),r};_getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=L({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!c(t.visible)||t.visible,activeType:oq(t),renderMode:"html",trigger:c(t.trigger)?t.trigger:"hover",className:c(t.className)?t.className:"vchart-tooltip-element",enterable:!!c(t.enterable)&&t.enterable,transitionDuration:c(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=c(t.triggerOff)?t.triggerOff:this._spec.trigger,c(t.renderMode)?this._spec.renderMode=t.renderMode:Jo(this._option.mode)&&(this._spec.renderMode="canvas"),c(t.mark)&&(this._spec.mark={...R(t.mark),activeType:"mark"}),c(t.dimension)&&(this._spec.dimension={...R(t.dimension),activeType:"dimension"}),c(t.parentElement)?f(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:qo(this._option.mode)&&(this._spec.parentElement=Ko?.body),c(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=aq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:BX.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(h(this._cacheInfo)||h(t))return!1;if(x4(t)){if(b4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>S$(t,e[i])))}if(x4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(c(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(c(n)&&c(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function w4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function A4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const k4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??w4(e)};let o=!1;return f(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??A4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class M4 extends I2{static type=dn.label;type=dn.label;name=dn.label;layoutType="absolute";layoutZIndex=$X.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new M4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(RX.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(lV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(lV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Dl(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:v$.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:v$.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=k4[s.type]??k4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return L({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class C4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(b(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:l(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&c(t.modelId)){if(c(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&c(t.modelKey)&&"modelIndex"in t&&c(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>T4(t))),a=s.filter((t=>!T4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>T4(t))),h=o.filter((t=>!T4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);b(o.width)||(o.width=a.width),b(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function T4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class E4 extends PK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&T$(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&E$(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}dK.useChart([H1,l2,j1,N1,S2,h2,d2,u2,b2,m2,U1,w2,a2,o2,p2,T2,E2,Y1,X1,g2,_2,v2,A2,W1,k2,M2,V1,x2,n2,y2,s2]),dK.useComponent([E3,R3,B3,L3,D3,j3,$3,S4,l5,h5,z2,F2,q3,t5,I5,Z3,D5,y5,M4,L5,j2,H2,Z2]),b$.registerLayout("grid",C4),b$.registerLayout("layout3d",E4),t.Arc3dMark=FJ,t.ArcMark=DJ,t.AreaChart=H1,t.AreaMark=aJ,t.AreaSeries=oJ,t.Bar3dChart=N1,t.Bar3dSeries=eJ,t.BarChart=j1,t.BarSeries=zZ,t.BaseChart=GK,t.BaseMark=FK,t.BaseSeries=Sq,t.BoxPlotChart=V1,t.BoxPlotMark=GZ,t.BoxPlotSeries=$Z,t.Brush=j2,t.CartesianAxis=A3,t.CartesianBandAxis=R3,t.CartesianChart=YK,t.CartesianCrossHair=l5,t.CartesianLinearAxis=E3,t.CartesianSeries=wq,t.CartesianTimeAxis=B3,t.CellMark=F1,t.CirclePackingChart=W1,t.CirclePackingSeries=f1,t.CircularProgressChart=p2,t.CircularProgressSeries=iQ,t.CommonChart=U1,t.ComponentMark=HK,t.ContinuousLegend=$3,t.CustomMark=H2,t.DataZoom=z2,t.DiscreteLegend=j3,t.DotSeries=ZJ,t.Factory=b$,t.Funnel3dChart=X1,t.Funnel3dSeries=T0,t.FunnelChart=Y1,t.FunnelSeries=M0,t.GaugeChart=n2,t.GaugePointerSeries=D1,t.GaugeSeries=L1,t.GeoCoordinate=t5,t.GridLayout=C4,t.GroupMark=zK,t.HeatmapChart=s2,t.HeatmapSeries=z1,t.Histogram3dChart=o2,t.HistogramChart=a2,t.Indicator=q3,t.Label=M4,t.Layout=PK,t.Layout3d=E4,t.LineChart=l2,t.LineMark=JZ,t.LineSeries=QZ,t.LinearProgressChart=g2,t.LinearProgressSeries=sQ,t.LinkPathMark=C1,t.LinkSeries=QJ,t.MapChart=h2,t.MapLabelComponent=Z2,t.MapSeries=CJ,t.MarkArea=D5,t.MarkLine=I5,t.MarkPoint=L5,t.PathMark=wJ,t.Pie3dChart=u2,t.Pie3dSeries=zJ,t.PieChart=d2,t.PieSeries=OJ,t.Player=y5,t.PolarAxis=I3,t.PolarBandAxis=L3,t.PolarChart=e2,t.PolarCrossHair=h5,t.PolarLinearAxis=D3,t.PolarSeries=TJ,t.PolygonMark=k0,t.ProgressArcMark=eQ,t.ProgressLikeChart=i2,t.ProgressLikeSeries=tQ,t.Pyramid3dMark=C0,t.RadarChart=m2,t.RadarSeries=XJ,t.RangeAreaChart=y2,t.RangeAreaSeries=hJ,t.RangeColumn3dChart=v2,t.RangeColumn3dSeries=rJ,t.RangeColumnChart=_2,t.RangeColumnSeries=sJ,t.Rect3dMark=tJ,t.RectMark=OZ,t.RoseChart=b2,t.RoseLikeChart=f2,t.RoseLikeSeries=GJ,t.RoseSeries=YJ,t.RuleMark=HZ,t.SankeyChart=x2,t.SankeySeries=T1,t.ScatterChart=S2,t.ScatterSeries=UJ,t.ScrollBar=F2,t.SequenceChart=w2,t.SunburstChart=A2,t.SunburstSeries=u1,t.SymbolMark=XZ,t.TextMark=FZ,t.ThemeManager=l$,t.Title=Z3,t.Tooltip=S4,t.TreeMapChart=k2,t.TreeMapSeries=I1,t.VChart=dK,t.WaterfallChart=M2,t.WaterfallSeries=jZ,t.WordCloud3dChart=E2,t.WordCloud3dSeries=h0,t.WordCloudChart=T2,t.WordCloudSeries=l0,t.default=dK,t.version="1.1.0-beta.9",Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart/package.json b/packages/vchart/package.json index 712927d5d8..4ac8c24ed2 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "1.1.0-beta.8", + "version": "1.1.0-beta.9", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js",